Re: inconsistent behavior with user-defined new and delete
On May 30, 5:56 pm, jeffjohnson_al...@yahoo.com wrote:
[...]
new(&pool) foo() calls
void* operator new( std::size_t, void* ) throw() ;
new(pool) foo() calls
void* operator new( std::size_t, my_pool & ) throw(bad_alloc) ;
If both are called "placement new", then how do we differentiate
between them?
With difficulty:-).
In section =A75.3.4 (the description of the new operator), the
standard clearly includes both of these under the name
"placement new". In section =A718.5.1.3 (the description of the
placement operator new function in the library), it just as
clearly only consideres the first under the term "placement
new".
In the end, I can't think of anything better that "standard
placement new" and "user-defined placement new". But we really
need a different name for the "placement syntax" described in
=A75.3.4, since it really is a misnomer.
The former places the object at the given address,
while the latter can do something else entirely.
By attempting to clarify what looked like a misunderstanding,
I've inadvertently committed a sin of terminology.
Join the club. The authors of the library section of the
standard didn't do any better.
--
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