20-06-2006, 12:29 PM
By character values, we include all character constants such as
c3 and c4 are set to implementation defined values, which need to be documented under 3.1.
Here 61 is a numeric value, and therefore cannot be assigned to type char_t.
Rule 6.1 states that arithmetic cannot be performed on character types.
The only guaranteed ordered sequence is '0' thru '9'.
Therefore code such as
is implementation independent, but would still require a deviation against rule 6.1 .
Code:
char_t c1 = 'a';
char_t c2 = '\\n';
char_t c3 = '\\0x41';
char_t c4 = '\\015';
c3 and c4 are set to implementation defined values, which need to be documented under 3.1.
Code:
char_t c5 = 61;
Here 61 is a numeric value, and therefore cannot be assigned to type char_t.
Rule 6.1 states that arithmetic cannot be performed on character types.
The only guaranteed ordered sequence is '0' thru '9'.
Therefore code such as
Code:
c1 = '0' + 3;
is implementation independent, but would still require a deviation against rule 6.1 .
Posted by and on behalf of the MISRA C Working Group