Re: strange behaviour powl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Vonka wrote:

> Note that the only difference is "1" instead of "K" on line 3.
> I compile by following command:
> 
> gcc blan.c -lm
> 
> In case A the answer of gcc is
> /cygdrive/c/Temp/ccEHzDhs.o:blan.c:(.text+0x30): undefined reference to
> `_powl'
> collect2: ld gaf exit-status 1 terug

There is no need to ever use -lm under Cygwin because all math functions
are in the main cygwin1.dll.  Specifying -lm is a no-op.

> In case B the program compiles without any problem and returns correct
> answer when run. Both programs compile when substituting "pow" for
> "powl". The switch "-lm" makes no difference(!), the result is exactly
> the same without it.

Cygwin does not provide an implementation of powl().  In case B the
compiler optimized away the call to the function because it recognised
that raising a number to the power of 1 does nothing.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux