Christopher Benson-Manica wrote:
Jack Klein <ja*******@spamcop.net> spoke thus: Christopher Benson-Manica wrote:
Are the members of a struct guaranteed to have ascending memory
addresses?
Yes, always in C.
Just for my edification, what is the chapter and verse? Thanks...
In C90, it's 6.5.2.1, verse 11:
"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."
This is a bit vague, since you don't technically declare the units
bit-fields reside in (but rather the bit-fields that go in them, but
adjacent bits fields do go into each unit). Bit-field members within a
unit are in implementation-defined order.
--
Derrick Coetzee
I grant this newsgroup posting into the public domain. I disclaim all
express or implied warranty and all liability. I am not a professional.