With this post I will be starting some random collection of things that I consider being defects of the C11 standard. Perhaps someone of the committee could pick them up or send me a mail to discuss them and eventually formulate a formal defect report.
C11 expresses the intention to have atomic_flag as a primitive that should allow to emulate all other atomic types and operations, 7.17.8 p3 in a note says:
The remaining types can be emulated with
atomic_flag, though with less than ideal properties.
Comments Off on C11 defects: initialization of
As we have seen in the earlier post, if you dig deeper into it the C data model is quite complex and has corner cases that are a bit bizarre. This might make C weirder than it need to be at a first approach.
As I said, the two most important properties of objects (or values) in C are if they are mutable (or not) and if they are addressable (or not), leaving us with 4 principal categories of objects that we have to deal with.
For beginners in C the different terms that C applies to data items are often confusing. There are variables, literals, integer constants, compound literals, expressions, lvalues, rvalues… In this post I will try to put a bit of systematic into this and at the end move towards a simplified model.
First of all any sort of data in C usually has a type and a value. For example the literal
0 has the type
unsigned int and
double. But other kind of data may have different properties, e.g variables may be modifiable and may be scoped, some data has an address in memory and some doesn’t, etc.