avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] AVR-Gcc and overflow behavior


From: David Kelly
Subject: Re: [avr-gcc-list] AVR-Gcc and overflow behavior
Date: Mon, 14 Apr 2008 16:51:37 -0500
User-agent: Mutt/1.4.2.3i

On Mon, Apr 14, 2008 at 05:33:13PM -0300, Jonathan Blanchard wrote:
> I was reading thought a recent discussion in the GCC dev list and also
> the following blog : www.airs.com/blog/archives/120 ;
> 
> I'm now curious about how the avr port of gcc behave in front of
> overflows. Does it assume by default that overflow never occur?

The nature of embedded programming says that if one is coding on the
edge and expecting a particular behavior out of one's tools then one had
better code tests to ensure the tool operates as expected. *THEN*
document it in comments buried in the source.

IMO signed variables are used way too much. I always use unsigned except
in special cases where signed is needed. The "norm" (at least outside of
the embedded world) is to use signed for everything but for the special
cases where unsigned is uniquely appropriate.

I use #include <stdint.h> for all my type definitions. This way there is
no question as to the size or signedness of a char when its uint8_t.

-- 
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.




reply via email to

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