04-10-2018, 10:21 AM
Note: The MISRA-C 2012 guidelines do not tell you to "add the cast". Without the cast the user would definitely get a MISRA C violation and possibly a compiler warning. In both cases the user might then choose to add a cast to remove the warning.
In adding a cast the user has signified that he has considered what happens when the cast is applied.
Aside: The example has a 10.3 violation between the return type of uint32_t and the expected type of int32_t.
In adding a cast the user has signified that he has considered what happens when the cast is applied.
Aside: The example has a 10.3 violation between the return type of uint32_t and the expected type of int32_t.
Posted by and on behalf of the MISRA C Working Group