z88dk forums

z80 Development Kit

You are not logged in.

#1 2016-04-02 07:01:13

alvin
Administrator
Registered: 2007-07-16
Posts: 1522

sdcc has made chars unsigned by default rather than signed

Recently sdcc has changed its char type to be unsigned by default.  For programs that expect signed chars this can lead to errors and warnings.  Compiling with an additional command line flag "--fsigned-char" will cause sdcc to treat char as a signed type as was the default before the change.  This affects the current zsdcc binary supplied by z88dk.

The reason for the change is that small uPs, including the z80, are better suited to unsigned types and use of unsigned char rather than signed char leads to faster and more compact code.  The thinking is people who use "char" to declare variables are not consciously making a decision about whether "char" should be signed or unsigned.  The C standard specifically states that whether char is signed or not is implementation defined.  Portable C code should always use "signed char" or "unsigned char" to declare char-size variables.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson