Re: This HAS to be UB...
On Oct 4, 1:46 am, Hendrik Schober <spamt...@gmx.de> wrote:
Victor Bazarov wrote:
[...]
Well, the default implementation of the operator delete[]
does *not* have the "size" argument. In fact there are two
allowed declarations of the operator delete[]:
void operator delete[](void* ptr) throw();
and
void operator delete[](void* ptr, const std::nothrow&) throw();
While that's true for global 'operator delete', my reading of
3.7.3.2/2 seems to indicate that class-specific versions can
indeed have a second argument of type 'std::size_t'. ICBWT.
Actually, the only requirement for defining an operator delete
function is that the first argument have type void*. You can
declare and define delete functions with any other arguments you
want. What is relevant here is the fact that *IF* there is no
operator delete[]( void* ) in the class, but there is a operator
delete[]( void*, std::size_t ), the latter will be used as the
"usual" deallocator, and not only for placement delete.
And at global scope, the standard defines three operator
delete[]: (void*), (void*, std::nothrow const&) and (void*,
void*).
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34