MISRA Discussion Forums
Rule 11.1 Interpretation - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.11 Pointer Type Conversions (https://forum.misra.org.uk/forumdisplay.php?fid=38)
+---- Thread: Rule 11.1 Interpretation (/showthread.php?tid=204)



Rule 11.1 Interpretation - nikunj - 02-02-2006

Rule 11.1 says that, 'coversions shall not be performed between a pointer to a function and any other type other than an integral type'

what do the 'integral type' refer to?

Is there a violation in the following code:

int (*p)();
int *a;
p = a; /* is this a violation of Misra rule 11.1 ? */


- misra-c - 20-06-2006

integral type is defined char, short, int, long, ( signed and unsigned).

Your code example is a constraint error, which breaks rule 1.1.

Most pointer conversions require an explicit cast.