On 01.10.2011 18:20, Jonathan Wakely wrote:
On 1 October 2011 15:50, Ami Chayun wrote:
What is the proper way to make GCC inline the function?
As it says on the page you linked to:
"The way to use it is to put a function definition in a header file
with these keywords, and put another copy of the definition (lacking
inline and extern) in a library file."
Thanks for the quick answer Jonathan.
I've tried to remove the inline from the definition in the source file
, add even add an explicit declaration like:
circle.c:
#include <math.h>
#define PI 3.141592
float area(float radius);
float area(float radius)
{
return pow(PI*radius, 2);
}
Still, when I try to link with the library I get the same warning and
the code isn't inlined. Could you show an example for the proper syntax?
Ami