[ECOS] malloc vs. new
Pierre Merlin
pierre.merlin@clarus-networks.fr
Mon Jun 24 04:27:00 GMT 2002
Hi Scott,
On Sunday 23 June 2002 03:03, Scott Dattalo wrote:
> On Sat, 22 Jun 2002, Dan Conti wrote:
> > 1) write your own operator new/new[]/delete/delete[]. tossing the
> > following into some file should work:
>
> I thought about this, but when you overload new and delete the constructor
> is no longer called (actually, that's an assumption on my part). So I'll
> have to add special code to initialize the objects as they're new'd.
I think your assumption is wrong. IIRC, when you call _ new _, it always
works as follows :
1) allocates memory space, using operator new
2) initializes the object(s) being created, using the constructor
Pay attention to this distinction between the NOT overloadable new and the
operator new, which you can redefine at your convenience.
Regards,
Pierre
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list