Rules 16-2-1 and 16-2-2 - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19) +---- Forum: 6.16 Preprocessing directives (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=144) +---- Thread: Rules 16-2-1 and 16-2-2 (/showthread.php?tid=1239) |
Rules 16-2-1 and 16-2-2 - dg1980 - 28-04-2016 Hi, strictly interpreted, these rules ban conditional compilation, rendering rules 16-1-1 and 16-1-2 mute. E.g.: Code: #ifdef FEATURE_X In addition, there appears to be no such rule in MISRA C 2012 (presumably, because it is a widely used feature in embedded systems): Rule Mapping to MISRA C 2012 16-0-2 [Required] n.a. but namespaces are not available in C 16-1-1 [Required] n.a. 16-2-1 [Required] n.a.prohibits conditional compilation which is allowed in C 16-2-2 [Required] n.a.prohibits conditional compilation which is allowed in C I would expect that a feature like the preprocessor, which is equal in C and C++, is treated equally across all MISRA standards. Is there any chance this will be corrected/clarified in a new version or technical corrigendum? Re: Rules 16-2-1 and 16-2-2 - dg1980 - 29-04-2016 For the sake of completeness, these are the rules which are consistent between MISRA C++ and MISRA C: Rule Mapping to MISRA C 2012 16-0-1 [Required] 20.1 [Advisory] 16-0-3 [Required] 20.5 [Advisory] 16-0-4 [Required] Dir 4.9 [Advisory] 16-0-5 [Required] 20.6 [Required] 16-0-6 [Required] 20.7 [Required] 16-0-7 [Required] 20.9 [Required] 16-0-8 [Required] 20.13 [Required] 16-1-2 [Required] 20.14 [Required] 16-2-3 [Required] Dir 4.10 [Required] 16-2-4 [Required] 20.2 [Required] 16-2-5 [Advisory] 20.2 [Required] 16-2-6 [Required] 20.3 [Required] 16-3-1 [Required] 20.11 [Required] 16-3-2 [Advisory] 20.10 [Advisory] Re: Rules 16-2-1 and 16-2-2 - misra cpp - 11-10-2016 Yes, currently you need a deviation. This is being reviewed |