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.
Announcements for z88dk releases
1 post • Page 1 of 1
- Well known member
- Posts: 1872
- Joined: Mon Jul 16, 2007 7:39 pm