4.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

The following example

char foobar;

defines an unsigned char object called foobar.

Differences

The 8-bit compilers have always treated plain char as an unsigned type.

The 16- and 32-bit compilers used signed char as the default plain char type. The -funsigned-char option on those compilers changed the default type to be unsigned char.

Migration to the CCI

Any definition of an object defined as a plain char and using the 16- or 32-bit compilers 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;

You can use the -funsigned-char option on MPLAB XC16 and XC32 to change the type of plain char, but since this option is not supported on MPLAB XC8, the code is not strictly conforming.