* * * * *
Neat, but I still don't like it
I'm not a fan of tail call optimization [1], but still, I didn't quite
realize that gcc (Gnu Compiler Collection) [2] will optimize tail calls if
given the -O2 option (found while reading Hacker News [3]).
Okay, this is something I have to try out:
> [spc]lucy:/tmp>cat >forever.c
> int main(int argc,char *argv[])
> {
> return main(--argc,argv);
> }
> ^D
> [spc]lucy:/tmp>gcc forever.c
> [spc]lucy:/tmp>./a.out
> Segmentation fault (core dumped)
> [spc]lucy:/tmp>gcc -O2 forever.c
> [spc]lucy:/tmp>./a.out
> (several minutes go by)
> ^C
> [spc]lucy:/tmp>
>
That's interesting. Not sure how it'll impact any code I write, but still,
it's interesting.
[1]
gopher://gopher.conman.org/0Phlog:2007/10/19.1
[2]
http://gcc.gnu.org/
[3]
http://news.ycombinator.com/item?id=803462
Email author at
[email protected]