lkml.org 
[lkml]   [1999]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: linux-2.2.1-ac3 and egcs-19990131
> 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.200 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site