Created on 2013-09-12.00:00:00 last changed 130 months ago
Proposed resolution:
This wording is relative to N3691.
Change [new.delete.placement] as indicated:
void* operator new(std::size_t size, void* ptr) noexcept;-?- Requires: ptr shall not be a null pointer.
-2- Returns: ptr. -3- Remarks: Intentionally performs no other action. -4- [Example: This can be useful for constructing an object at a known address:void* place = operator new(sizeof(Something)); Something* p = new (place) Something();— end example]
void* operator new[](std::size_t size, void* ptr) noexcept;-?- Requires: ptr shall not be a null pointer.
-5- Returns: ptr. -6- Remarks: Intentionally performs no other action.
[ 2014-02-15 post-Issaquah session : move to Tentatively NAD ]
AJM to supply the rationale...
Based on this discussion and as discussed in c++std-core-23998 and c++std-lib-34442, calling placement new currently forces the compiler to check if the pointer is null before initializing the object (a non-negligible cost). It seems many people were not aware of this and they consider it a user error to pass a null pointer to it.
Proposed resolution: for operator new and operator new[], add:Requires: ptr shall not be a null pointer.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 13:52:20 | admin | set | messages: + msg6896 |
2014-03-03 13:52:20 | admin | set | status: new -> nad |
2013-10-06 18:38:24 | admin | set | messages: + msg6674 |
2013-09-12 00:00:00 | admin | create |