[comp.lang.c++] Constructors produced by CFront?

amb@Apple.COM (A. Michael Burbidge) (01/22/91)

Upon examining some of the C code produced by Cfront I discovered something in
constructors that I don't understand.

Given the following class hierarchy:

BaseBase
  Base
    Derived

The constructor for Derived attempts to allocate space for Derived if it this
fails then it attempts to allocate space for Base, if this fails it attempts
to allocate space for BaseBase. If at any point space is successfully allocated
then the code in the corresponding constructor is executed.

The only time that a new on Derived actually fails is when BaseBase can't be
allocated.

Given this code it appears that it is possible to do a new on Derived and 
actually get back a BaseBase. But there would be no way to tell that this had
occurred.

What is going on here and why?

Mike Burbidge
amb@apple.com