MISRA Discussion Forums
How to fix Warnings 10.1 and 10.3 - 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.10 Arithmetic Type Conversions (https://forum.misra.org.uk/forumdisplay.php?fid=37)
+---- Thread: How to fix Warnings 10.1 and 10.3 (/showthread.php?tid=1186)



How to fix Warnings 10.1 and 10.3 - chas - 12-06-2015

Hi. We're new to MISRA-2004. Can anyone explain why I get these warnings and how to fix them. We are using Code Composer.

unsigned int x = 0U;
unsigned int* px;

px = &x; /* 10.1 warning */
px = (unsigned int*)&x; /* 10.3 warning */


Re: How to fix Warnings 10.1 and 10.3 - misra-c - 25-06-2015

Both lines are compliant with all MISRA-C:2004 rules, except Rule 6.3 which requires typedefs instead of "unsigned int".

Rules 10.1 and 10.3 only apply to integers types whereas these operations are on pointers.