Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pointer to function conversions (11.1)
#2
Question 1:
When compatible types are assigned, as in this first example, no "conversion" takes place. Therefore, Rule 11.1 is not relevant to this assignment.

Question 2:
The C language treats each enumerated type as compatible with an integer type. The choice of integer type is implementation-defined.

If the type chosen by the implementation for enum STYPE_LIST is compatible with int32_t then p and p2 have compatible types. The type cast is not required, no conversion takes place and Rule 11.1 is not relevant.

However, if the type chosen by the implementation for enum STYPE_LIST is not compatible with int32_t then p and p2 do not have compatible types. The type cast then violates Rule 11.1.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)