Andy Reitz wrote:
> So, clearly, something is optimizing the pow() function away when the
> arguments are hard-coded lvalues, instead of varibles.
> Now, what that thing *is*, I don't know.

The C compiler precomputes constant expressions; your "pow(2,3)" is
being rewritten to "8" by the compiler.  Similarly, if you write
"1 + 2 / 3 + 4 * 5 - 6", the C compiler will turn this into "15"
rather than producing a series of instructions which computes the

When you reference variables, this optimization isn't possible, since
those variables might be modified before you reach the line where
they are used.  (Obviously this doesn't happen in your program, but
the compiler isn't smart enough to figure that out.)

Colin Percival
_______________________________________________ mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to