RE: [Dev-C++] new is a wrapper around malloc so...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@em...> - 2003-07-15 17:26:06
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Daniel Glenfield > Sent: Tuesday, July 15, 2003 10:13 AM > To: dev...@li... > Subject: [Dev-C++] new is a wrapper around malloc so... > > > Hi guys, > I'm writing some code for 16 bit and have code split into > segments. This > means I need to create a Far version of new, but I don't know > much about > malloc - can anyone show me what operator new looks like? new is not a wrapper of malloc(). It is an entity of its own. In fact malloc() should not be used in C++ because it does not call the object's costructor. Also there is no guarantee that even for POD types new, delete and the malloc() family,free() are interoperable. I do not know what a Far pointer, but I do know that they exist. Can you tell us what does it mean? You can overide the operator new to define its functionality (e.g. to provide space from an array of yours in the stack). It is what TC++PL names "placement operator new". Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |