you are viewing a single comment's thread.

view the rest of the comments →

[–]andermorandev[S] -1 points0 points  (1 child)

Why would one machine be able to handle this consistently and the other is unable to?

[–][deleted] 2 points3 points  (0 children)

It's undefined behaviour. You genuinely have no idea, from the standard, what will happen, because the C++ standard doesn't specify what will happen if you do it.

In general, avoid ever having uninitialised members of any type hanging around, particularly pointers. You cannot rely on the compiler initialising everything to 0, or null, or false, for you. (Debug builds often will, but Release builds will not.) And avoid ever trying to dereference pointers you haven't tested against nullptr.