Re: Build-in sqrt()?
- From: "santosh" <santosh.k83@xxxxxxxxx>
- Date: 26 Nov 2006 20:22:13 -0800
peng.xiaoyu@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 under
linux
The actual details of creating executable code from C source is
implementation dependant and the C standard says nothing about it.
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.
.
- Follow-Ups:
- Re: Build-in sqrt()?
- From: peng.xiaoyu@xxxxxxxxx
- Re: Build-in sqrt()?
- References:
- Build-in sqrt()?
- From: peng.xiaoyu@xxxxxxxxx
- Build-in sqrt()?
- Prev by Date: Re: Writing an int to a file, not quite sure how buffers work.
- Next by Date: Re: Writing an int to a file, not quite sure how buffers work.
- Previous by thread: Build-in sqrt()?
- Next by thread: Re: Build-in sqrt()?
- Index(es):