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 inline fn's?


From: E. Weddington
Subject: Re: [avr-libc-dev] Can pgmspace.h __LPM_xxx__ macros become inline fn's?
Date: Thu, 30 Sep 2004 15:50:15 -0600
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Theodore A. Roth wrote:

On Thu, 30 Sep 2004, E. Weddington wrote:

Hmm.
All of the pgm_* API is implemented as #defines that eventually boil
down to the __*LPM* style identifiers. Wouldn't declaring them as static
make them non-visible outside of avr/pgmspace.h? I don't think this is
desirable.

No. You are confusing .h and .c files. The macro or inline func will be
visible to any file that #includes the header. Nothing changes in that
respect.

Read what the gcc manual says about static and extern when used with an
inlined function:

 http://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/Inline.html#Inline


Thanks Ted, and Geoffrey Wossum for the corrections, and thanks for the link Ted; it helped tremendously.

Unfortunately that section still seems to leave the issue a little clouded.

It doesn't say if use of "static inline" can be used with functions outside the module. It does say that use of "extern inline" can be used almost like a macro, including inlining the function in other modules. However, now these new __*LPM_* functions have to be implemented in .c files and rolled into the library, correct? And there are different functions for different architectures. Then there is the issue of whether we want these to be inlined even when no optimization is used (implying use of the always_inline attribute). And there is the issue of whether to use "inline" or "__inline__".

Wouldn't it be simpler to figure out what it is about the macros that -pedantic doesn't like?

Eric




reply via email to

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