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: E. Weddington
Subject: Re: [avr-libc-dev] Can pgmspace.h __LPM_xxx__ macros become inlinefn's?
Date: Thu, 30 Sep 2004 16:39:57 -0600
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Bill Somerville wrote:

<explanations>

Thanks for the explanations!

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

The problem is that the used of a braced block in the middle of an
expression is not leagal C or C++. The block is required so that
automatic variables can be introduced for local storage (these are in
fact optimised away).


I was afraid it was that.

inline in C++ and now C99 was introduced to get around this problem
among others of which the most useful are the type safety of compiler
checked arguments etc, the avoidance of multiple evaluation of complex
arguments, and that the fn names are handled by the compiler which
honours C/C++ scoping rules unlike the CPP which doesn't.


Ok. So making this change makes a lot of sense.

The only issue I still see is when optimization is turned off. Currently the macros will put the code in the function no matter what the optimisation setting. It looks like using inline will not do this without using that always_inline function attribute. I would assume that if this change was made that it would be documented in the user manual about requiring optimisation.

Eric




reply via email to

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