This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: linux-2.2.1-ac3 and egcs-19990131
- To: mrs at wrs dot com
- Subject: Re: linux-2.2.1-ac3 and egcs-19990131
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Wed, 3 Feb 1999 10:08:18 +0100
- CC: egcs-bugs at cygnus dot com, linux-kernel at vger dot rutgers dot edu, vonbrand at sleipnir dot valparaiso dot cl
- References: <199902030324.TAA18773@kankakee.wrs.com>
> Gee, and I thought only C++ provided extern inline:
It seems that ISO C 99 has extern inline functions. 6.7.4/2 says
>> An inline definition of a function with external linkage shall not
>> contain a definition of a modifiable object with static storage
>> duration, and shall not contain a reference to an identifier with
>> internal linkage.
And paragraph 6 says
>> For a function with external linkage, the following restrictions
>> apply: If a function is declared with an inline function specifier,
>> then it shall also be defined in the same translation unit.
I don't understand this entirely. It seems that there must be exactly
one definition of such a function in a single translation unit, which
is then used by other translation units. To me, this allows the
following usage
/* foo.h */
inline void foo(){}
/* foo.c */
extern void foo(); /* Compiler emits out-of-line code in foo.o */
/* bar.c */
void bar(){
foo(); /* Inline call */
}
void* bar1(){
extern void foo();
return (void*)&foo;
}
Any comments?
Martin