Topic: Plumbing?


Author: Satish_Dharmaraj@transarc.com
Date: Thu, 24 Mar 1994 19:31:24 -0500
Raw View
I am trying to write a plumber. Basically, I want to
replace new and delete with my own new and delete. The catch is
I want the replaced new operation to also get the __FILE__ and
__LINE__ directives from the place where new was called.

For eg:, I replace malloc with a simple macro

# define malloc(x) MyMalloc(x,__FILE__,__LINE__)

What do I do for new? (other than defining a brand new class,
and then use that class instead of new.)

Is there a way to get the __FILE__ and __LINE__ variables from
my redefinition of operator new??

Satish