Keil™, An ARM® Company

Technical Support

ARMCC: PLAIN CHAR VS. SIGNED CHAR


Information in this article applies to:

  • RealView C Compiler Version 3

QUESTION

I am using in my software typedef's to allow easy migration between different platforms. However the typedef for the INT8 datatype causes warning messages when I am passing it to standard C functions that take a char* parameter. I am getting the message:

warning:  #167-D: argument of type "INT8 *" is incompatible
                  with parameter of type "char *"

The data type INT8 is defined as:

typedef signed char INT8;

What are the reasons for this warning messages?

Can I disable the warning messages?

ANSWER

There is a difference between a plain char and a signed char. By default a plain char represents an unsigned char value. Using the compiler directive --signed_chars changes the default behaviour of plain char to be a signed char. In µVision this is configured under Project - Options - C/C++ - Plain Char is Signed.

Since your typedef is not 100% compatible, you are getting these warning messages.

You have the following options to solve the problem:

  • Change the typedef for INT8 to:
    typedef char INT8;
    
    When you use the compiler directive --signed_chars you define with INT8 effectively a signed char.
  • Since the warning is uncritical you may disable the warning using:
    #pragma diag_suppress 167
    

Last Reviewed: Thursday, August 17, 2006


Did this article provide the answer you needed?
 
Yes
No
Not Sure