Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

knowledge for noobs

Name: Anonymous 2016-07-23 4:48

How are procedure calls implemented? well you need to push a return address so that once the procedure completes it knows where to go back to, and you need to push all the parameters too, then you simple jump into the procedures code address.

And what is a tail call? its exactly the same as a normal procedure call except that the current stack frame is replaced or overwritten rather than a new one being created.

Name: Anonymous 2016-07-23 5:29

>>1
And what is a tail call? its exactly the same as a normal procedure call except that the current stack frame is replaced or overwritten rather than a new one being created.
That's an optimized tail call. A tail call in general is just a recursive function, call at the end of a procedure, which may or may not overwrite the current stack frame. An infinite recursion algorithm like
int f(n) {
n++;
return f(n+1);
}

will cause a stack overflow if unoptimized, but will be transformed into a simple infinite loop if optimized.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List