Standard C++ Library Reference ISO/IEC (VERSION3)

contiguity of storage allocated by successive calls is unspecified. The initial stored value is unspecified.
The returned pointer points to the start (lowest byte address) of the allocated storage. If count is zero,
the value returned does not compare equal to any other value returned by the function.
The default behavior is to execute a loop. Within the loop, the function first attempts to allocate the
requested storage. Whether the attempt involves a call to malloc(size_t) is unspecified. If the
attempt is successful, the function returns a pointer to the allocated storage. Otherwise, the function calls
the designated new handler. If the called function returns, the loop repeats. The loop terminates when an
attempt to allocate the requested storage is successful or when a called function does not return.
The required behavior of a new handler is to perform one of the following operations:
make more storage available for allocation and then return
call either abort() or exit(int)
throw an object of type bad_alloc
The default behavior of a new handler is to throw an object of type bad_alloc. A null pointer
designates the default new handler.
The order and contiguity of storage allocated by successive calls to operator new(size_t) is
unspecified, as are the initial values stored there.
The second function:
void *operator new(std::size_t count,
const std::nothrow_t&) throw();
is called by a placement new expression to allocate count bytes of storage suitably aligned to represent
any object of that size. The program can define a function with this function signature that replaces the
default version defined by the Standard C++ library.
The default behavior is to return operator new(count) if that function succeeds. Otherwise, it
returns a null pointer.
The third function:
void *operator new(std::size_t count, void *ptr) throw();
is called by a placement new expression, of the form new (args) T. Here, args consists of a single
object pointer. The function returns ptr.
operator new[]
void *operator new[](std::size_t count) // REPLACEABLE
throw(std::bad_alloc);
void *operator new[](std::size_t count, // REPLACEABLE
const std::nothrow_t&) throw();
void *operator new[](std::size_t count, void *ptr) throw();
The first function is called by a new[] expression to allocate count bytes of storage suitably aligned to
represent any array object of that size or smaller. The program can define a function with this function
signature that replaces the default version defined by the Standard C++ library.