In comp.sys.ibm.pc.hardware.chips Yousuf Khan said:
Well, I'm sure the C compiler implementation would know when it's accessing
a stack element or a data element, and use the appropriate pointers (i.e.
stack or data). When are the only times you'd be pointing to an element on
the stack? It's usually only done when accessing a passed argument. You
should know which arguments are passed into a function, and which ones are
local to the function.
In a function, automatic local variables are on the stack. I can pass
the address of one of these to any function which is expecting a
pointer of that type, I could also pass an address of a global or an
address returned by malloc, all in the same function call; think
printf and friends and character string arguments. In fact, with a
literal format string and using gcc defaults, I'd also be passing a
pointer in the text area of the program since gcc defaults to putting
ro strings in the code area.
Jerry
---snip-----