Recursive Functions (58)

43 Name: #!/usr/bin/anonymous : 2008-09-24 17:30 ID:Heaven

>>42

> baz is relevant because you fucking call it

The external call to baz is to prevent gcc from eliminating the take-address-of operation. It demonstratedly has no bearing on tail-call elimination; gcc will (for example) optimize the tail call on this code:

extern int baz(int *z);
static void foo(int x) {
if (baz((int*)x) <= 0) return;
x--;
foo(x);
}
void bar(int x) {
foo(&x);
}
> I'm a C cognoscente and I don't expect anyone who disagrees with me to be correct.

However, you're still wrong. Being a C connoisseur means you can appreciate C. It doesn't mean you know C; it doesn't mean you know C implementations. In fact it's clear that you don't know C or gcc very well at all.

> I have explained why those cases that seem obvious, are NOT cases where tail-call optimization can be applied.

No, you haven't. You have simply declared it so, done some handwaving about C not having stack variables, and then ate a thesaurus.

You're still wrong.

This thread has been closed. You cannot post in this thread any longer.