3 ms·
> For example, people rely on how C lays things out in memory, so C compilers have to lay things out in memory in specific ways. One can rely on C compilers la
by bluetomcat 10y ago
> For example, people rely on how C lays things out in memory, so C compilers have to lay things out in memory in specific ways.
One can rely on C compilers laying out things in memory in a specific way only within a struct and when compiler-specific alignment/packing attributes are used. All other assumptions about variables being adjacent in memory are wrong and lead to undefined behavior.
- yxhuvud 10y agoWell, one can rely on that array content is laid out sequentially in memory.