TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
ASML C Coding Standard

Rule:  6.4.9.aChecked automatically with code checker

Synopsis:Comments in the form of opening (/*) and closing (*/) shall not be nested.
Severity Level:2
Category:Lexical Elements



C does not support nesting of comments. However, some compilers allow this as a language extension. If so, the following code will not give a syntax error but just compiles and treat the critical function call as comments.

Example 1

/* some comment /* WRONG */                         
/* some other comment */

Example 2

/* This code is bracketed out because ... /* RIGHT */
 * code_to_be_excluded();    some other comment


The main argument for nesting comments is that it would allow programmers to "comment out" code. However, comments shall be used for adding documentation to a program and preferably mechanisms that already exist for source code exclusion shall be used.