09-08-2011, 08:47 AM
No, rule 16.5 does not apply to function pointers. However, note that:
Therefore, a pointer to a non-prototyped function cannot be used to call a function and cannot be converted to a pointer that could be used to call a function.
The rationale is to avoid the undefined behaviour that occurs when a function is called by means of a pointer whose type is not compatible with the called function.
- Rule 8.1 requires a function prototype to be visible at call
- Rule 11.1 does not permit a non-prototyped function pointer to be converted to a prototyped one
Therefore, a pointer to a non-prototyped function cannot be used to call a function and cannot be converted to a pointer that could be used to call a function.
The rationale is to avoid the undefined behaviour that occurs when a function is called by means of a pointer whose type is not compatible with the called function.
Posted by and on behalf of the MISRA C Working Group