Quote:
Originally Posted by
Driver
For what it's worth, it is my opinion that address space layout is not a "useful" thing to learn for a beginning or intermediate (or even expert) C programmer
It's important to understand the difference between heap, stack, and data memory as well as how C scope relates to it, and pointers are the most obvious way to show what difference it actually makes to the program.
To do that, you have to know what stack, heap, and data memory are, and why they're different, and what their limits are.
Besides, they're not all
that different. Whether a stack grows up or down it's still a stack, likely in a distinct area of memory.
Quote:
I guess you mean setting an alternative stack manually by using a library function such as sigaltstack()...?!
I don't think he means an alternative stack in that sense, not a different execution context, but a separate space for variables. The PIC14 microprocessor series, for instance, has a hardware function-call stack 8 or 16 calls deep, instruction pointers only, and no access methods but CALL and RET. Local variables are completely seperate and in their own memory block.
Of course, the PIC14 is a fleabrained microprocessor with less RAM than your average toaster and a memory map that can be used to frighten small children; it's a wonder that compilers exist for it at all. But you get the idea: Some processors don't fit C's idea of a function call that well.