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-16 09:04:57
|
All I know is that the MSDN documentation I read says 2GB. I'm not sure about how you calculate it all, so you're one up on me! >From: "Abhijit Shylanath" <mu...@gm...> >To: "Daniel Glenfield" <sp...@ho...> >CC: "Dev-Cpp mailing list" <dev...@li...> >Subject: RE: [Dev-C++] new is a wrapper around malloc so... >Date: Wed, 16 Jul 2003 00:40:19 +0530 > > > > In 16 bit your code is separated into 'segments' each a maximum of 64k >in > > size. 32-bit can have up to 2GB segments (!!!). > >4G, right? (2^32). > >However, that's true only on a 32-bit system (as you've said)... what >platform are you building on? On 16-bit (`real-mode') DOS, even though >sizeof(farptr) will give you four, it cannot address 32-bits worth of >memory. Far pointers work like this: > > 32 bits of farptr = > 16 bits of segment . > 16 bits of offset > >The effective address is actually calculated by multiplying the segment by >16 decimal (0x10 (which is equivalent to left-shifting by four)) and then >ADDING the offset... so that if your far-ptr has this value: > > 0x1234abcd > >Written as: > > 1234:abcd > >Its effective address, which is worth 20-bits (and can therefore address >2^20 = 1M) is calculated as: > > 0x12340 >+ 0xabcd >------------- >= 0x1cf0d > >Whereas, in the flat memory model(protected-mode), the effective address >would itself be > > 0x1234abcd > >-- >Abhijit Shylanath >Homepage: http://mudeth.tripod.com/ > _________________________________________________________________ On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile |