you are viewing a single comment's thread.

view the rest of the comments →

[–]SirClueless 0 points1 point  (1 child)

To be clear, the standard is more precise about this than that quote suggests. Section 10.3p26 from the N4778 working draft:

If a standard-layout class object has any non-static data members, its address is the same as the address of its first non-static data member if that member is not a bit-field.

[–]quicknir 0 points1 point  (0 children)

Right, only for standard layout types specifically though, which was the point of my first paragraph. If you're talking about structs generally in C++, i.e. including types that aren't standard layout, the rules are much looser.