I have always wondered what purpose it serves to redefine new. By this I mean when a developer uses:
#pragma push(macro,new)
#undef new
What purpose does this serve? I thought that the new operator was standard for all compilers?
Does redefining new give the developer a way to change the way new allocates space for objects?
You may think of it as away to log any allocation that happens in C++ program. So you need to define your own new operation which will log this allocation. also you need to redefine the delete to log all un-allocation made in C++.
Some tools redefine it and allocate more memory for starting and ending of the memory block and out certain signature in the head and tail to find out any buffer over run issues with your code. You can check MS Application Verifier which do so.