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

Pages: 1-

GCC Tail Calls

Name: Anonymous 2012-03-14 9:56

Is GCC able to optimize tail calls through function pointers?

Name: Anonymous 2012-03-14 10:07

Name: Anonymous 2013-05-19 13:59

$ cat | gcc -xc - && ./a.out

typedef (*fp)();

u(fp x)
{
    return x(x);
}

main()
{
    return u(u);
}

Name: >>3 2013-05-19 14:01

Now add -O{s,2,3} and see the magic happening.

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