Divick wrote:
Well in the above mentioned example, the sizes of both the classes are
same and does work with g++ as well while if you start adding members
to the classes such that the size differ then it crashes.
Divick
Newbies often find this a hard concept to grasp. Undefined behaviour
means that the C++ standard does not define any behaviour. That means
that it might work on one compiler, but it might crash on another. Both
compilers are right because the behaviour is undefined. Also it might
work in one situation (e.g. when the classes have the same size) but not
in another.
Who knows, it might work on a Wednesday but not on a Tuesday because the
behaviour is *undefined*.
john