avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] Can pgmspace.h __LPM_xxx__ macros become inlinefn's?


From: Geoffrey Wossum
Subject: Re: [avr-libc-dev] Can pgmspace.h __LPM_xxx__ macros become inlinefn's?
Date: Thu, 30 Sep 2004 17:16:07 -0500
User-agent: KMail/1.7

On Thursday 30 September 2004 5:02 pm, Bill Somerville wrote:

>
> Declaring as static would make each non-inlined version local to the
> translation unit that generates it. I think this is already implied by
> the inline keyword.

Unless they changed the semantics in C99, inline does not imply static.

If you do

inline void somefunc(void) {}

in header file and include it in multiple compilation units, you will get 
multiple definition errors upon trying to link them together.  That's why you 
need to do "static inline" or "extern inline".  

Personally, I prefer "extern inline", because then you know you'll never get a 
linkable version of the function generated in any object files.  However, 
I've read that "extern inline" is deprecated in GCC, and that "static inline" 
should be used for new code.  However, I think both glibc and the Linux 
kernel use "extern inline" all over the place, so it's probably not going 
away anytime soon.

---
Geoffrey Wossum
Long Range Systems - http://www.pager.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]