7.3.7 Plain char
Types
The type of a plain char
is unsigned char
. It is
generally recommended that all definitions for the char
type explicitly
state the signedness of the object.
Example
char foobar;
defines an
unsigned char
object called foobar
.Differences
When targeting PIC MCUs, the MPLAB XC8 compiler has always treated plain
char
as an unsigned type. When targeting AVR MCUs, the compiler has
used signed char
as the default plain char
type. Use
of signed char
has been true for MPLAB XC16, XC-DSC, and XC32. The
-funsigned-char
option on these compilers changes the default type
to be unsigned char
.
Migration to the CCI
char
needs review. Any
plain char
that was intended to be a signed quantity should be replaced
with an explicit definition, for
example:signed char foobar;
which is
the recommended method of defining such an object.You can alternatively use the -funsigned-char
option to change the type
of plain char
.