MISRA Discussion Forums
Essential Type of preprocessing statement - 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.10 The essential type model (https://forum.misra.org.uk/forumdisplay.php?fid=165)
+---- Thread: Essential Type of preprocessing statement (/showthread.php?tid=1135)



Essential Type of preprocessing statement - misra-c - 05-12-2014

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

Code:
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



Re: Essential Type of preprocessing statement - misra-c - 05-12-2014

The MISRA guidelines define "code" in the Glossary as
Quote:"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