RE: [Dev-C++] new is a wrapper around malloc so...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Abhijit S. <mu...@gm...> - 2003-07-15 19:05:11
|
> 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/ |