[previous] MISRA-C:2004  Rule  2.3:  (Required) [next] The character sequence /* shall not be used within a comment.
C does not support the nesting of comments even though some compilers support this as a language extension. A comment begins with /* and continues until the first */ is encountered. Any /* occurring inside a comment is a violation of this rule. Consider the following code fragment:

/* some comment, end comment marker accidentally omitted

<<New Page>>
Perform_Critical_Safety_Function( X );
/* this comment is not compliant */

In reviewing the page containing the call to the function, the assumption is that it is executed code.

Because of the accidental omission of the end comment marker, the call to the safety critical function will not be executed.


QAC messages that encompass this guideline:

3108 Nested comments are not recognized in the ISO standard.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents