MISRA Discussion Forums
Clarification on rule 10.6 - 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: Clarification on rule 10.6 (/showthread.php?tid=1170)



Clarification on rule 10.6 - anuj1085 - 24-03-2015

Is the rule only applies to "u" suffix or this rule also applies to "UL", "L" and other suffixes


Re: Clarification on rule 10.6 - misra-c - 01-04-2015

This rule only applies to integer constants for which the standard C type without a suffix is an unsigned type. For example 0x8000 is of type unsigned int in a 16-bit environment. Rule 10.6 requires you to add a "U" suffix in this case.

The rule does not require you to add other suffices, for example the "L" suffix to those constants which have a long C type.

More details on the background to this rule can be read in the MISRA C:2012 documentation for rule 7.2.