Hi, On Fri 28 Jan 2011 15:33, Noah Lavine <noah.b.lav...@gmail.com> writes:
>> And also... why not rely on gcc's tail-call optimization, in the case >> where it works? You can check for it at configure-time. I just ran >> some small tests for tail-calls between functions in separate >> compilation units and it shows that indeed, gcc does the right thing. > > I don't think you want to rely on that, because then programs might > break at -O0 that would work fine at higher optimization levels. You can always test that the compiler supports -foptimize-sibling-calls, and add it to CFLAGS as necessary. In any case you know at configure time whether it is supported or not, and can compile accordingly. > However, if GCC added a special intrinsic function that would always > do a tail call, then that could work. And they might very well add it > if we asked them to. Even if they did, we'd have to check for it anyway. Besides, the idiom already exists: return foo (...);. > Well, the JIT library can already tail-call C code. Great. Cool. The plans coalesce :) A -- http://wingolog.org/