alamanos opened this issue on Jan 29, 2007 · 127 posts
kuroyume0161 posted Thu, 01 February 2007 at 1:32 PM
That's because, well, code, stack, and data are usually, well, 'segmented'. This isn't 'segmented memory', this is segmented static program execution space. The code sections are placed into their own memory areas. A developer doesn't actually have to do this - you can put the code and data segments together for instance - but the stack is usually kept separate as it also maintained by the system pointer (activation frame of the running code). See "Memory as a Programming Concept in C and C++", pp. 14-16).
You are confusing code segments with memory segmentation - these are two different things. One allows code to be loaded into memory so as to 'appear' contiguous, the other allows limited memory address capability to be fooled into thinking it can address more (with those segment registers).
C makes it easy to shoot yourself in the
foot. C++ makes it harder, but when you do, you blow your whole leg
off.
-- Bjarne
Stroustrup
Contact Me | Kuroyume's DevelopmentZone