[previous] MISRA-C:2004  Rule  2.2:  (Required) [next] Source code shall only use C-style comments.
This excludes the use of // C99 style comments and C++ style comments, since these are not permitted in C90. Many compilers support the // style of comments as an extension to c90. The use of // in preprocessor directives (e.g. #define) can vary. Also the mixing of /* ... */ and // is not consistent. This is more than a style issue, since different (pre C99) compilers may behave differently.

Example Code:


#include "m2cmex.h"

extern S16 test_0202( void )
{
   /* Only use C style comments */

   s16a = 5;

   // Do not use C++ comments

   s16b = 6;

   return 1;
}


QAC messages that encompass this guideline:

1011 [C99] Use of '//' comment.


Related rules:

Rule  1.1 All code shall conform to ISO/IEC 9899:1990 C programming language, ISO 9899, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192



(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