RE: [Dev-C++] new is a wrapper around malloc so...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2003-07-15 18:48:50
|
In 16 bit your code is separated into 'segments' each a maximum of 64k in size. 32-bit can have up to 2GB segments (!!!). A 'near' pointer can access variables etc. within its own segment, while FAR pointers can access anything. Likewise a FAR variable can be accessed from anywhere (by a FAR pointer), while a NEAR one (the default) is local to that segment. Think of it like a telephone numbering system. My number is, say, 401234. But that is no good to you unless you live local to me. If you tried typing 401234 into the phone you'd not reach me if you lived far away. SO if I gave you my "FAR" number, it would be 01172 401234 and you would be able to reach me even if you were not local. This is how I understand NEAR and FAR. >From: "Ioannis Vranos" <iv...@em...> >To: <dev...@li...> >Subject: RE: [Dev-C++] new is a wrapper around malloc so... >Date: Tue, 15 Jul 2003 20:25:46 +0300 > > > -----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 > > > > >------------------------------------------------------- >This SF.Net email sponsored by: Parasoft >Error proof Web apps, automate testing & more. >Download & eval WebKing and get a free book. >www.parasoft.com/bulletproofapps1 >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband |