MISRA C:2012 8 Rules 8.1 A Standard C environment

8.1 

Program shall not violate the standard C syntax and constraints, the conversion shall not exceed the limit implementation

0232 escape sequence hexadecimal value in the "unsigned char" type can not be represented.

int ia = '\x4142';                    /* Message 0232 */

only one char character constant Byte size (irrespective wide character constant), '\ x4142' = 16706, over the range. 0-255

Hexadecimal escape sequence value shall not exceed the range of values ​​that can be expressed in unsigned char.

char type is used to store letters and punctuation characters and the like, but in the technology char is an integer type, because char type is actually stored integer rather than character

char grade  = 'A' ;

char grade = 65; // this is a bad programming style

It is strange, C will be treated as character constants of type int rather than char type

 

Guess you like

Origin www.cnblogs.com/focus-z/p/11456302.html