> Should the compiler optimise by computing n only once? (even possibly at compile-time) > Then, what if I'm doing that in purpose? (be it stupid or not) > > Denis
What is the difference? The only thing that is affected by this optimization is execution speed. Optimizing is about implementing the requested semantics in an efficient matter. Why would you actually want to suppress completely safe optimizations? Also, when benchmarking, you don't usually want to benchmark unoptimized code. Or am I misunderstanding something? If absolutely necessary, you can always use the volatile keyword to disable all optimizations on a given variable, or call the function explicitly using inline ASM.