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

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

Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline...


From: David Brown
Subject: Re: [avr-libc-dev] [bug #36921] util/delay.h uses inline...
Date: Tue, 24 Jul 2012 09:39:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

On 23/07/12 21:00, Joerg Wunsch wrote:
> As Weddington, Eric wrote:
> 
>> I would hate to say, "We have to use C99 for some avr-libc modules
>> (atomic.h), but we guarantee C89 compliance for other avr-libc
>> modules (delay.h)". We really should be consistent across the whole
>> project. Which means that if we guarantee C89 compliance for one
>> module, then it needs to be guaranteed for everything in avr-libc,
>> and we document what standard we comply too.
> 
> I'd say we *guarantee* C99 compliance, but wherever compliance to
> older standards could be reasonably had, I don't mind maintaining it
> that way.
> 
> Whenever compliance to C89/C90 would require a tradeoff, C99 takes
> precedence.  However, writing a couple of underscores in front of a
> keyword is nothing worth talking about, I think.
> 
>> Another data point: In the somewhat "standard" Makefile that we put
>> together for AVR applications, we always set the --std flag to gnu99
>> for compiling AVR applications.
> 
> Well, "gnu99" is yet another thing, we should make sure everything
> works with "c99" (i.e., without the GNU extensions).
> 


For my 2 øre, I agree mostly with this.  In the case of adding a couple
of underscores, it should not be too much hardship.  But I also see
Erik's point - how much should people bother making headers C89
compatible if few people use it that way, and other headers will never
be C89 compatible?

Is it really practical to use avr gcc without gnu extensions?  What
about "pedantic" mode?

One case that springs to mind here is when people have to follow a
particular coding standard, such as Misra (which is C89 based, IIRC), or
who have to program in a particular variant such as strict ANSI.  It is
very useful in such cases to be able to compile the code in C89 or ANSI
mode, since that lets the compiler spot errors better.  Should these
users be told that they can use most of the library, excluding specific
parts such as atomic.h, or should they be told that nothing is going to
work?


Do the C99-specific headers check __STDC_VERSION__ to give a
user-friendly error message if someone tries to use them in C89 mode?


Finally, I hope all the headers are also C11 compliant for the future...
(from what I've read of C11, I can't see any reason why not).





reply via email to

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