This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: multiple defintions error
- To: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Subject: Re: multiple defintions error
- From: Atif Shahab <atif at viewinternet dot com dot sg>
- Date: Thu, 28 Sep 2000 17:03:40 +0800 (SGT)
- cc: Jan Dvorak <johnydog at go dot cz>, gcc at gcc dot gnu dot org
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
******************************************************