User: Password:
|
|
Subscribe / Log in / New account

Betrayed by a bitfield

Betrayed by a bitfield

Posted Feb 4, 2012 13:57 UTC (Sat) by nix (subscriber, #2304)
In reply to: Betrayed by a bitfield by daglwn
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.)


(Log in to post comments)


Copyright © 2018, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds