Poll: does this violate strict aliasing? struct b { int x; } S; int *p = (int*)&S; *p = 1;
6.7.2.1 ¶15 ends with "and vice versa", i.e. if you have a ptr to initial member, it's valid to cast to struct ptr & access the struct.
-
-
(But only if the pointer actually points to the initial member of a struct of that type, not to a different struct type or no struct at all)
-
Yes, that seems the right way to look at it.
-
I'm worried about dynamic allocation though: https://godbolt.org/g/M3glwK One can hardly warn at the time p1, q1 are computed.
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.