C++ Migration Guide

Replacement Functions

If you have replacement versions of operator new and delete, they must match the signatures shown in "Exception Specifications", including the exception specifications on the functions. In addition, they must implement the same semantics. The normal forms of operator new must throw a bad_alloc exception on failure; the nothrow version must not throw any exception, but must return zero on failure. The forms of operator delete must not throw any exception. Code in the standard library uses the global operator new and delete and depends on this behavior for correct operation. Third-party libraries can have similar dependencies.

The global version of operator new[]() in the C++ 5.0 runtime library just calls the single-object version, operator new(), as required by the C++ standard. If you replace the global version of operator new() from the C++ 5.0 standard library, you don't need to replace the global version of operator new[] ().

The C++ standard prohibits replacing the predefined "placement" forms of operator new:

void* operator new(std::size_t, void*) throw();

void* operator new[](std::size_t, void*) throw();

They cannot be replaced in C++ 5.0 standard mode, although the 4.2 compiler allowed it. You can, of course, write your own placement versions with different parameter lists.