replacing new with macro conflicts with placement new replacing new with macro conflicts with placement new windows windows

replacing new with macro conflicts with placement new


You can catch placement new with a variadic macro:

#define NEW_DEBUG(...) NEW_DEBUG2(_NORMAL_BLOCK, __FILE__, __LINE__, __VA_ARGS__ )#define new NEW_DEBUG

But the preprocessor doesn't seem to allow defining a macro both witharguments and without, and a macro without arguments is applied first,so I didn't find a way to do this with a single preprocessor pass.But it seems possible with two, if we'd run first pass with above macros and /E,then second pass with

#define NEW_DEBUG new(_NORMAL_BLOCK, __FILE__, __LINE__)#define NEW_DEBUG2(...) new(__VA_ARGS__ )