-
The problem with that is that it breaks programs using placement new. So you'd need a pair of macros, and one of them would have to be a C99 variadic macro:
Code:
#define new(...) new(_Varargs)
#define new new(FileLine(__FILE__, __LINE__))
Mind you, I neither know how vararg macros really work, nor if you can overload a macro name on a function-style and an object-style macro. I think you can't.
-
But you could rename your new macro into something else, such as debug_new or whatever. This would keep them separate.
-
That is how I have done it in the past - just wanted to see if there was perhaps another trick.
Great.
Thanks for all the help guys. It seems to be working great.