[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] are signed chars signed :-) ?
From: |
gouy yann |
Subject: |
Re: [avr-gcc-list] are signed chars signed :-) ? |
Date: |
Tue, 7 Sep 2004 10:43:16 +0200 (CEST) |
--- Uwe Arends <address@hidden> a écrit :
> > > > I just understood that 2 minutes ago by
> looking at the avr-libc source!
> > > > First time that I encounter such an
> environment! I have to go thru all my
> > > > code to modify 'char' to 'signed char'.
> > >
> > > you probably know about the -fsigned-char
> commandline switch, don't you?!?!?
> > >
> >
> > The "-fsigned-char" flag would definitely save him
> some effort, but it is
>
> That was the intention, to save him some work.
>
> > still best to be explicit in the code. Writing
> code whose correctness
> > depends on compiler flags is a bad idea.
>
> yup
>
> > As a rule, plain "char" should only be used when
> you really mean a
> > character - i.e., a letter in a string. "unsigned
> char" and "signed char"
> > are silly names - what sense is there in talking
> about a negative letter?
> > The best way (in that it makes your code more
> readable, and removes a source
> > of error) is to use typedefs to give sensible
> names to "unsigned char" and
> > "signed char", which you then use consistently. A
> prime example would be to
> > simply include the <inttypes.h> from avr-libc, and
> use int8_t and uint8_t.
I must say that if uint8_t is explicitly unsigned,
int8_t can be confusing, IMHO, sint8_t would habe been
a much better name.
personnaly, I use redefined types u8, s8, u16,...
they are quite short and explicite.
regards.
Yann
>
> I wholeheartedly agree :-)
>
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
>
=====
Vous manquez despace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour
dialoguer instantanément avec vos amis. A télécharger gratuitement sur
http://fr.messenger.yahoo.com
RE: [avr-gcc-list] are signed chars signed :-) ?, Bernard Fouché, 2004/09/09