3 ms·
C99 TC3 §6.7.2.1p13 "structure and union specifiers": "Within a structure object, the non-bit-field members and the units in which bit-fields reside have addre
by fanf2 9y ago
C99 TC3 §6.7.2.1p13 "structure and union specifiers":
"Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that increase in the order in which they are declared."
- zurn 9y agoThe as-if rule allows compilers to perform this optimization, provided they elide the optimization for those structs that have addresses of members taken/used, though. This requires whole program analysis of course (as in clang / gcc "LTO" compilation mode). And of course there could be language extensions to loosen this rule further on a per-struct basis.