[new.delete.single]
Change: Linking new and delete operators.
Rationale: The two throwing single-object signatures of operator new and
operator delete are now specified to form the base functionality for
the other operators. This clarifies that replacing just these two signatures
changes others, even if they are not explicitly changed.
Effect on original feature:
Valid C++ 2003 code that replaces global new or delete
operators may execute differently in this International Standard. For
example, the following program should write "custom deallocation" twice,
once for the single-object delete and once for the array delete.
#include <cstdio> #include <cstdlib> #include <new> void* operator new(std::size_t size) throw(std::bad_alloc) { return std::malloc(size); } void operator delete(void* ptr) throw() { std::puts("custom deallocation"); std::free(ptr); } int main() { int* i = new int; delete i; // single-object delete int* a = new int[3]; delete [] a; // array delete }
[new.delete.single]
Change: operator new may throw exceptions other than
std::bad_alloc.
Rationale: Consistent application of noexcept.
Effect on original feature:
Valid C++ 2003 code that assumes that global operator new only
throws std::bad_alloc may execute differently in this International
Standard.