Conversion of a function pointer to a different type of pointer results in undefined behaviour. This means, for example, that a pointer to a
function cannot be converted to a pointer to a different type of function.
Noncompliant Code Example
int f(int a)
float (*p)(float) = (float (*)(float)) & f; // Noncompliant
- MISRA C:2004, 11.1 - Conversions shall not be performed between a pointer to a function and any type other than an integral type.
- MISRA C++:2008, 5-2-6 - A cast shall not convert a pointer to a function to any other pointer type, including a pointer to function type.
- MISRA C:2012, 11.1 - Conversions shall not be performed between a pointer to a function and any other type