This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCC built-in functions
- From: Da Zheng <zhengda1936 at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 25 Feb 2010 16:05:34 +0800
- Subject: Re: GCC built-in functions
- References: <1267083055.2848.8.camel@Ubuntu>
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