Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
11.3 - char * to uint8_t *
#5
This response assumes that uint8_t is defined as "unsigned char".

Section 8.11 of the MISRA-C:2012 guidelines summarizes the implicit conversions that are permitted by the C language. The list of permitted implicit conversions does not include conversions from char* to unsigned char*. Therefore your example violates the constraints of the C language and hence is not compliant with rule 1.1 of the MISRA-C:2012 guidelines.

The example is also not compliant with rule 7.4, which states that "A string literal shall not be assigned to an object unless the object's type is "pointer to const-qualified char"". Assigned includes the implicit conversion that occur on passing an argument to a function.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)