N
Nikos Chantziaras
What's the best way to allow the compiler to inline a function in C? (Not
C99, which already supports the 'inline' keyword.)
The way I do it, is to define the functions in question as 'static' in a
header file:
static void foo()
{
/* ... */
}
Almost every compiler these days will inline the function when compiling
with optimizations turned on (GCC does, I think). Anyway, can something go
wrong with this approach? And if yes, is there a better way to achieve
this?
C99, which already supports the 'inline' keyword.)
The way I do it, is to define the functions in question as 'static' in a
header file:
static void foo()
{
/* ... */
}
Almost every compiler these days will inline the function when compiling
with optimizations turned on (GCC does, I think). Anyway, can something go
wrong with this approach? And if yes, is there a better way to achieve
this?