(a)

#define new new( __FILE__, __LINE__ )

(b)

VoidPtr operator new( UInt32 size, CharPtr pFileName, ULong lineNum );
VoidPtr operator new[] ( UInt32 size, CharPtr pFileName, ULong lineNum );

(c)

VoidPtr operator new( UInt32 size, CharPtr pFileName, ULong lineNum )
{
   return _DbgMemPtrNew( size, pFileName, lineNum );
}
VoidPtr operator new [] ( UInt32 size, CharPtr pFileName, ULong lineNum )
{
   return _DbgMemPtrNew( size, pFileName, lineNum );
}

Example 3: The three steps to remapping the new and new[] operators.

Back to Article