J
jacob navia
Kaz said:In proper C terminology, this is called ``automatic storage''.
One of the "implementations"
Automatic storage can be implemented using dynamic allocation and
deallocation, rather than a stack.
Yes. IT could also be implemented by somebody going to the computer
store, buying some RAM, putting it in the machine and then
taking it away when the program exists that function...
But is it REALISTIC?
Do you know of a single C implementation that doesn't use a stack?
I asked this question two days ago and not a single answer came.
THERE IS NONE.
Automatic storage does form a logical stack, in the sense of the word
when it is generalized to refer to any kind of LIFO structure in
computer science.
OK. That is what I was saying.
This is not what people mean by ``stack'' in the context of the
machine representations of programs; the term ``stack'' refers to a
linear block of memory where allocation and deallocation is performed
by moving a pointer.
All stacks have a stack pointer! Logical stacks ALSO.
That is false. Many modern processors have no special hardware support
for a stack.
Interesting. Can you name a single processor that doesn't have a
stack pointer?
Some general-purpose register is designated by convention
to serve as a stack pointer, whose value is maintained using ordinary
arithmetic instructions, and which is indirected upon using ordinary
addressing modes. The memory region for the stack is allocated using
ordinary means also.
Like all hardware stacks that I know of.
Some processors have a stack register assigned by the hardware,
some processors have a stack register assigned by the OS. So what?
The end result is the same.
Maybe by ``overwhelming majority'' you are referring to the installed
base of X86 compatible processors.
I am referring to the fact that a hardware stack is needed
to save/restore registers and data across function calls in ANY
processor.
Unless the processor doesn't implement calls obviously.
All processors must use some way of saving/restoring the
program counter to be able to implement a function call.
It is amazing how the "regulars" manage to go on speaking nonsense
without ever answering a concrete question:
Where is the C implementation that doesn't use a stack?
Some implementations, lacking some hardware support for
a hardware stack use a software stack but ALL use a stack.
Please name a single one that doesn't use a stack.
Thanks