Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!emory!ogicse!qiclab!cabezon!oliverk From: oliverk@cabezon.uucp (Oliver Kozber) Newsgroups: comp.windows.ms.programmer Subject: Bug in BC++ ?? Message-ID: <1991Apr4.190320.6276@cabezon.uucp> Date: 4 Apr 91 19:03:20 GMT Sender: oliverk@cabezon.uucp (Oliver Kozber) Distribution: usa Organization: Logic Automation Inc of Beaverton Oregon Lines: 58 In the following code the body of the constructor is not executed if I use my new operator. ------------------------------------------------------------- class TEST { public: TEST( int x ); int Num(); void FAR *operator new ( size_t size ); int number; }; TEST::TEST( int x ) { number = x; // *LINE* // } int TEST::Num() { return( number ); } void FAR *TEST::operator new ( size_t size ) { GLOBALHANDLE hGmem = GlobalAlloc( GMEM_MOVEABLE, size ); TEST FAR *lpGmem = (TEST FAR *) GlobalLock( hGmem ); return( lpGmem ); } -------------------------------------------------------------- When I call the constructor with the global 'new' operator the constructor executes the "*LINE*" assignment and it works fine. TEST FAR *tp = ::new TEST( 5 ); // global new operator But if I call it using my 'new' operator, "*LINE*" never gets executed. TEST FAR *tp = new TEST( 5 ); // my new operator Looking at it with the turbo debugger I see that the code jumps to the end of the constructor after executing my "new" operator, i.e. it doesn't come back to the constructor to do the *LINE* assignment. Why? Am I doing something wrong, or is this a bug in BC++. Thanks for any help, Oliver Kozber ...!ogicse!lauto!oliverk