oliverk@cabezon.uucp (Oliver Kozber) (04/05/91)
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