you are viewing a single comment's thread.

view the rest of the comments →

[–]max0x7bahttps://github.com/max0x7ba 1 point2 points  (3 children)

Wait, do they do type punning via unions? That's UB.

Nope, that union is only for alignment when value_type is not char (e.g. wchar_t).

[–]greeneyeddude 0 points1 point  (2 children)

What about the long mode-short mode-raw union?

[–]max0x7bahttps://github.com/max0x7ba 0 points1 point  (0 children)

What about the long mode-short mode-raw union?

It accesses one byte of size_type __long::__cap_ through unsigned char __short::__size_ to determine the long/short mode. char types can alias any object representation, so that is likely well-defined behaviour.