Essential Type of preprocessing statement

Moderators: misra-c, david ward

Post Reply
misra-c
Posts: 566
Joined: Thu Jan 05, 2006 1:11 pm

Essential Type of preprocessing statement

Post by misra-c » Fri Dec 05, 2014 1:47 pm

Does the essential type system intended to apply to preprocessing expressions?
For example:

Code: Select all

void foo (void)
{
   (0 == 1) + 1;        /* non-compliant with Rule 10.1 */
}

#if (0 == 1) + 1     /* compliant or non-compliant with Rule 10.1 ? */

#endif
---
Posted by and on behalf of
the MISRA C Working Group

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

Re: Essential Type of preprocessing statement

Post by misra-c » Fri Dec 05, 2014 1:51 pm

The MISRA guidelines define "code" in the Glossary as
"Code consists of everything within a translation unit that is not excluded by conditional compilation.
. Therefore, the guidelines apply to code after preprocessing directives have been executed, unless otherwise stated in a guideline.

Therefore "#if (0 == 1) + 1 " is not a violation of rule 10.1
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “8.10 The essential type model”