> An example from Stroustrup:
> int f (int n)
> if (n==1) return 1;
> return n * f(n-1);
> A super intelligent compiler would
> replace f(3) to the value 6.
> That's the utopia.
No, that's the future. In fact, computing facto at compile time can already be done in c++ using templates.
static int value = facto::value * n;
static int value = 1;
I think the compiler can replace f(3) by 6 by copy propagation techniques.
Utopia is perhaps something like this:
int fibo(int n)