ARM Memory Tagging is a great example of why it's A Good Thing that pointer arithmetic and relational operators are only defined for operands within a single array.
Bitfield members don't have addresses or offsets, so it's not really meaningful to ask about their order. Of course bytes corresponding to them appear in the representation though. Within a unit the order is implementation-defined.
-
-
Order could be important
-
Yes. In practice implementations (ABIs) define bitfield bit order to match byte order.
-
But back to your question, for something like struct { int a, b; } c;, the < operator and other relational operators are not defined for operands &c.a and &c.b (&c.a<&c.b is UB). However (char*)&c.a < (char*)&c.b is defined in the representation array.
-
If the char* array representation is the only one doesn't one imply the other? I'm assuming there is only one "physical" block of memory defined as the structure.
-
It's just a matter of how the < operator is defined. It's only defined for elements of the same array. There is an overlaid representation array of unsigned char [2*sizeof(int)]. There is not an overlaid array int[2].
-
huh, i have tons more questions but they'll never end so i might as well find a book.
-
Hah, good luck finding a book on C that's not all misinformation. ;-)
-
I'm assuming it'll have to be the spec
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.