J
jacob navia
user923005 said:void foo(int a)
{
int b;
if (condition_not_met()) foo(a);
}
assembly skeleton pseudocode:
void foo(int a)
{
allocate b and store it in a hash table...
call condition_not_met() test function
if return is true{
allocate a copy of a and put it in a hash table. Give this copy to
new foo() call
find copy of a in hash table
remove a from hash table
}
...
remove b from hash table
}
This is not a stack (and just to be contrary, I will remove items
stored a,b,c in order a,b,c instead of b,c,a when I exit). It will
run on a machine without a hardware stack or a software stack.
Logically, it produces the same result as using a stack would.
Thanks. I am collecting all the regular's speculation in a paper
I will send to Guiness. Your proposal is quite similar
to one proposed before, where the stack is implicitely done with
a clock.
Hash tables are normally indexed by names. If you have several "b"s
in your hash table, which one will you remove?
Then, you will have a naming schema, that will simulate stack using
timestamps or similar mechanisms...
Fantastic!
And so what?
This is a typical attitude of the regulars here.
1) They say
"C doesn't use a stack. The word is not mentioned in the standard"
Objective: Confuse beginners and display pedantic knowledge...
2) When confronted to reality (no implementation exists that doesn't use
a stack, and above all, confronted with the stack like structure of
the language itself) they start with
3) An implementation *could* exist that... etc.
This is similar to their "trap representation", "one's complement" or
"sign magnitude" stuff... Nobody has ever seen those machines, there are
no implementations but
"... an implementation *could* exist" and there they go.
But all that is harmless. LET IT BE.
You believe "C" (whatever you understand with that) doesn't need a
stack?
Be happy!!!
Live your life!!!