Keil Logo

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 these 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
    

SEE ALSO

Last Reviewed: Tuesday, March 23, 2010


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.