Re: Build-in sqrt()?
- From: "peng.xiaoyu@xxxxxxxxx" <peng.xiaoyu@xxxxxxxxx>
- Date: 26 Nov 2006 22:12:39 -0800
On 11月27日, 下午12时22分, "santosh" <santosh....@xxxxxxxxx>
wrote:
peng.xia...@xxxxxxxxx wrote:
hello everyone,
why this c code can be compiled and linked without -lm?
#include<math.h>
#include<stdio.h>
int main()
{
printf("%f\n",sqrt(2.0));
return 0;
}
even NO sqrt symbol when i use nm to list symbols from the object file
someone can give me a hint? i'm using a gcc-4.1.2 with glibc2.4.1 underimplementation dependant and the C standard says nothing about it.
linuxThe actual details of creating executable code from C source is
Under UNIX it is traditionally the case that the math library is a
seperate file and hence has to be specifically included at link time. A
specific implementation may well include the math functions along with
the rest of the standard C library.
Standard C, and this group, really has nothing to say about your
observation.
Sorry for my asking such a question in comp.lang.c. I post the problem
here because I doubt whether strange behaviour only caused by the
compiler and not something related to linker. So i ask is there a
build-in sqrt() in the topic.
Thank you all the same
.
- References:
- Build-in sqrt()?
- From: peng.xiaoyu@xxxxxxxxx
- Re: Build-in sqrt()?
- From: santosh
- Build-in sqrt()?
- Prev by Date: Re: scanf behaviour
- Next by Date: Re: inserion sort code
- Previous by thread: Re: Build-in sqrt()?
- Next by thread: Re: Build-in sqrt()?
- Index(es):