static inline

Jim Wilson wilson@specifixinc.com
Thu Sep 25 09:49:00 GMT 2003


He HongFu wrote:
> Hi, all:
> 	I declare a function as following:	
> 	static inline void foo () {
>     }
> 	Is foo() function just like declare "inline"? i.e, the modifier "static" is invalid here.

The answer depends on what language you are compiling, which you didn't
specify.  Is this GNU C, ISO C90, ISO C99, GNU C++, or ISO C++?

For GNU C, static inline means that if all calls to the function are
inlined, and the function's address is not taken, then we will not emit
an out-of-line copy of the function.

This is covered in the GCC manual.  See
	http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Inline.html#Inline
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list