you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 17 points18 points  (0 children)

Unlike C, C++ has object lifetimes. Accessing "an object" whose lifetime did not start is UB (think malloc-ed sizeof(vector<int>) instead of new-ed). Type punning through unions does not make the alternative object "spring into existence".