On May 30, 12:04 pm, Pete Becker <p...@versatilecoding.com> wrote:
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? The former places the object at the given address,
while the latter can do something else entirely.
The latter does exactly the same thing as the former: it calls an
overloaded version of operator new. The name for that usage is
"placement new."
Yes, and I've already openly admitted my sin of terminology, the part
which you clipped. I shall admit this once again, even though you may
clip that and correct me again. Please forgive me.
My question is still valid, however. If both are called placement
new, then what do I say when I mean this
new(&buffer) foo() ;
and what do I say when I mean this
new(debug_alloc) foo() ;
Obviously I can't just say "placement new" for both. In practice,
when one says "placement new", one usually means placing the object at
the given address, i.e. the former. In particular I bet most C++
programmers would say "placement new" for the first one and something
like "new with debug_alloc" for the second one. "Placement new with
debug_alloc" is likely to cause confusion.
If I may assess the situation, it appears that you wish to be pedantic
about what is correct terminology, while I wish to be practical about
what is clear and unambiguous terminology.
you and someone else higher up in the thread.
object at (or is it that "in"? correct me!) some pre-existing storage.
header, a pure placement new or the standard library's placement new.
A: Because it messes up the order in which people normally read text.
A: Top-posting.