------- Comment #7 from jima at cadence dot com  2007-03-21 16:13 -------
(In reply to comment #6)
> ... the proper way is to start a new object lifetime using placement new.

Are you referring only to internal operations in MyHeap::Malloc (in the demo
program), or do you mean that the overall scheme can be re-coded somehow
to use placement new without any casts?

If the latter, I don't understand how that is possible, because the type of
the object being allocated is not known -- the API of override operator new
is (void *, size_t).

Note that the interface we are trying to preserve (in use for many years) is
that application programmers simply derive from a special base class when
declaring their own classes, and then objects will use the special allocator.
We can not require application coders to explicitly write placement-new
(or call any kind of special allocator interface); that would be unworkable
for human reasons, and also would prevent using generic template functions
which must use ordinary "new" to allocate objects of template-parameter type.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31289

Reply via email to