Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!olivea!apple!amb From: amb@Apple.COM (A. Michael Burbidge) Newsgroups: comp.lang.c++ Subject: Constructors produced by CFront? Keywords: constructor Message-ID: <48320@apple.Apple.COM> Date: 21 Jan 91 17:02:25 GMT Organization: Apple Computer Inc., Cupertino, CA Lines: 26 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