I recently ran into a problem in my project. I usually compile it in gcc-4, but after trying to compile in gcc-3, I noticed another call to the built-in functions. To illustrate this, I created a simple example:
main.c:
#include "header.h"
#include <stdio.h>
int main()
{
printf("f() %i\n", f());
return 0;
}
file.c:
#include "header.h"
int some_function()
{
return f();
}
header.h
inline int f()
{
return 2;
}
When I compile the code in gcc-3.4.6 with:
gcc main.c file.c -std=c99 -O2
( f), , -O2. , -, , , f , , main.c, file.c, . , , f static, , , f .
gcc-4.3.5 :
gcc main.c file.c -std=c99 -O2
, gcc inlined f , f ( gdb, ).
, -O2, undefined int f().
, . , gcc , f , , ( -O2) , .
: , , , ? ? , , gcc-4 , , ?