Re: GCC built-in functions

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

 



On 10-2-25 下午3:30, Steve Teale wrote:
> There's a fair chunk of code in GCC that builds tables of information
> about built-in functions.
> 
> I assume that these are there for good reason, and my guess was that
> they would obviate the need for many common header files, which in fact
I think built-in functions are more than functions. My understanding is that a
built-in function cannot be defined as a normal function and it needs the
special support of the compiler.
> they seem to do. But if I have a tiny program like:
> 
> int main()
> {
>     float f;
>     f = cos(1.0);
>     printf("%f\n", f);
>     return 0;
> }
> 
> compilation produces warnings:
> 
> steve@Ubuntu:~/scratch$ gcc nohead.c
> nohead.c: In function ‘main’:
> nohead.c:4: warning: incompatible implicit declaration of built-in
> function ‘cos’
> nohead.c:5: warning: incompatible implicit declaration of built-in
> function ‘printf’
> steve@Ubuntu:~/scratch$ ./a.out
> 0.540302
> 
> The program runs. Why is gcc warning me about its own internals? Also,
> incompatible with what?
cos and printf are not built-in functions of GCC. They are defined in C library.
You don't provide their declarations, and I guess GCC somehow assume that they
are built-in functions.

Zheng Da


[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