4 ms·
for a definiton of "just memory" that includes the strict aliasing rule. Certainly not a buffer of bytes, what most people would assume when they hear "just mem
by 1ris 4y ago
for a definiton of "just memory" that includes the strict aliasing rule. Certainly not a buffer of bytes, what most people would assume when they hear "just memory".
- jb1991 4y agoThe strict aliasing rule that you point out is not part of the “just memory” part, but rather the “syntax sugar” part. Now you can debate if it’s the right kind of sugar, however.
- 1ris 4y agoNo, The strict aliasing part of the semantic of the memory. “syntax sugar” is, per definition, part of the syntax.
- gpderetta 4y agoIndeed. What the strict aliasing rule implies is that only well typed C programs have meaning. Which means that C is indeed not "just memory". If C was just memory, the only operations allowed would be on and through memory addresses, and values wouldn't be first class.
- jstimpfle 4y ago"Memory" might not even be a concept in the C standard, rather it is what C programmers think about in practice. The culture around the language is that the language should get out of the way as much as possible while still providing a good amount of convenience, portability, and performance. The standard is a necessity, but is not the center of attention while working.
- int_19h 4y agoBut then there's the memcpy escape hatch that lets you treat anything and everything as a raw sequence of bytes with no concern for types or aliasing. So arguably the fundamental memory model is still "just memory" (albeit not necessarily a single address space), and the rest is bolted on top and applies only to specific language constructs.