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

Category: Preprocessing Directives

Synopsis:Rules about preprocessor constructions


Description:

Coding Rules

NameCheckedSynopsis
6.10.a Checked automatically with code checker Use of pre-processor directives shall be according to strict ANSI syntax and constraints.
6.10.b Checked automatically with code checker Only perform token pasting with the token pasting operator (##).
6.10.1.a Checked automatically with code checker Code checker flags shall not be used in the source code.
6.10.1.c Checked automatically with code checker #ifdef, #ifndef, #if defined and #if !defined are not allowed in external header files.
6.10.1.d Checked automatically with code checker C headers should be guarded by extern "C".
6.10.2.a Checked automatically with code checker All headers files shall be identified by an #include directive.
6.10.2.b Checked automatically with code checker Including source files is not allowed.
6.10.2.c Checked automatically with code checker It is forbidden to include hpp files in C files.
6.10.3.a Use of macros shall strictly be according to the ANSI C89 macro syntax and within the ANSI C89 macro constraints.
6.10.3.b Checked automatically with code checker #define macros shall only be used for symbolic constants. They shall not be used for function like macros if a function can be written to accomplish the same task.
6.10.3.c Checked automatically with code checker Any instance of macro parameters, macro body and macro operations shall be enclosed within parenthesis.
6.10.3.d Checked automatically with code checker Macros should not end with a semicolon.
6.10.3.e Checked automatically with code checker Use a semicolon at the end of a function-like macro call.
6.10.3.2.b Checked automatically with code checker A macro shall not comprise both the "#" and "##" operators simultaneously.
6.10.3.3.a Checked automatically with code checker Result of "##" operator shall be a legal pre-processing token.
6.10.3.4.a Checked automatically with code checker Recursive macro definitions shall not be used.
6.10.3.5.a Checked automatically with code checker Macros shall only be #define'd and #undef'ed at file scope.
6.10.4.a Checked automatically with code checker The line splicing character ('\' at the end of a line) shall not be used, except in preprocessor macros.
6.10.4.b Checked automatically with code checker When used, the line-splicing character ('\' at the end of a line) shall immediately be followed by the newline character.
6.10.4.c Checked automatically with code checker Do not use mixed EOL characters in a file.
6.10.6.a Checked automatically with code checker The pragma directive and pragma operator shall not be used.
6.10.8.b Checked automatically with code checker Only the predefined macro names __FILE__, __LINE__ and __func__ may be used.