Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 14
#5
By character values, we include all character constants such as

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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)