This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: static inline
- From: Jim Wilson <wilson at specifixinc dot com>
- To: He HongFu <hhfesle1982 at 163 dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 24 Sep 2003 22:24:12 -0700
- Subject: Re: static inline
- References: <20030924065725.C8EAA1CF8344A@sm212.163.com>
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