Betrayed by a bitfield
Posted Feb 4, 2012 13:57 UTC (Sat) by nix
In reply to: Betrayed by a bitfield
Parent article: Betrayed by a bitfield
I'm simply pointing out that any code that relies on the layout of a struct or how its members are accessed is inherently non-portable.
Not so: you can depend on later members of a struct having strictly higher addresses than earlier ones: i.e., the compiler cannot reshuffle struct members. (This is not an especially exciting guarantee, but it's all we've got.)
to post comments)