This is the mail archive of the
mailing list for the GCC project.
Re: [doc] empty loops
> Also, playing with empty loops, I was shocked after looking at the code
> created for the recursive variant of
> void foo(void)
> for (int i=0; i<1000; ++i)
> static inline void foo3(int i)
> if (!(i<1000))
> void foo4(void)
> I thought Zednek contributed a patch for optimizing these
> tail-recursive functions
> some time ago.
could you please explain what exactlu shocks you here? Tail recursion
elimination on this example works perfectly fine for me.
> Even for a standard n! implementation we suck.
Not that much; iv optimizations could do a bit better job in
this case, but the code that we produce basically is
int fact(int n)
i = 0;
m = 1;
while (n - i != 0)
m *= n - i;
which is not that bad.