Question on rule 4.1

Moderators: misra-c, david ward

Post Reply
Seilo
Posts: 1
Joined: Mon Jul 07, 2014 8:41 am
Company: Rolls-Royce

Question on rule 4.1

Post by Seilo » Mon Jul 07, 2014 9:57 am

Hello,

I need to know if my example is compliant :

Code: Select all

int test = 0x1234;
If it's not compliant, can I have some examples to use hexadecimal affectation.

Best regards.

misra-c
Posts: 556
Joined: Thu Jan 05, 2006 1:11 pm

Re: Question on rule 4.1

Post by misra-c » Mon Aug 04, 2014 3:51 pm

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
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “8.4 Character sets and lexical conventions”