MISRA Discussion Forums

Full Version: Question on rule 4.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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