This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: multiple defintions error



Ok, now I'm confused.  I'll explain my understanding and can anyone point
out the mistake.

inline is a keyword suggesting to the compiler to include the code
whereever the funtion is colled (if possible).

extern is a keyword meaning that the function/variable is implemented in
some other file.

extern inline would mean that the function is to be inlined but is
implemented in some other file.

Now assuming that all the functions are inlined at compile time, I really
can't see how the code size gets lower or better cache usage takes place.

However, if I assume that the functions are not inlined by the compiler, I
think I can see why lower code can come about.  However as for the better
cache usage, it suggests faster execution but isn't this a long jump
compared to static inline where the jump to my understanding is short.

On Tue, 26 Sep 2000, Joern Rennecke wrote:

> > It is like you copy&paste such function into each source file, so no
> > performance penalities occurs. It is IMHO the only way how to share
> > functions which has to be inlined.
> 
> No, there is also the 'extern inline' extension of gcc.
> This way, you can have just a single out-of-line copy of the function,
> giving a lower code size and better cache usage.
> 

-- 
Atif Shahab
Network Engineer
ViewInternet.com
Office Tel: +65 232 8877
DID: +65 232 8625
Office Fax: +65 232 8638
www.viewinternet.com.sg

******************************************************
Check your email from anywhere using www.viewemail.com
******************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]