On Tue, 11 Apr 2006, Jonathan Herriott wrote:

> Question then.  Why would it work when I don't use variables if I
> don't include the library?  This question is just out of curiosity.

That's a pretty good question. In the case where we have pow(x,y), I see
this:

[EMAIL PROTECTED]/src]$ gcc -c pow_test.c
[EMAIL PROTECTED]/src]$ nm pow_test.o
00000000 T main
         U pow
         U printf

In the case where it is pow(2,3), I see this:

[EMAIL PROTECTED]/src]$ gcc -c pow_test.c
[EMAIL PROTECTED]/src]$ nm pow_test.o
00000000 T main
         U printf

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.

-Andy.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to