MISRA Discussion Forums
Question on rule 4.1 - 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:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21)
+---- Forum: 8.4 Character sets and lexical conventions (https://forum.misra.org.uk/forumdisplay.php?fid=159)
+---- Thread: Question on rule 4.1 (/showthread.php?tid=1074)



Question on rule 4.1 - Seilo - 07-07-2014

Hello,

I need to know if my example is compliant :
Code:
int test = 0x1234;
If it's not compliant, can I have some examples to use hexadecimal affectation.

Best regards.


Re: Question on rule 4.1 - misra-c - 04-08-2014

Rule 4.1 only refers to escape sequences. Your example does not contain an escape sequence and is therefore compliant with rule 4.1

Escape sequences may only occur in character constants or string literals. Examples of escape sequences covered by this rule are:
\11 - octal escape sequence denoting a character with numerical value 9
\x12 - hexadecimal escape sequence denoting a character with numerical value 18