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

Rule:  5.1.1.c

Synopsis:With respect to includes, each source file (.c and .h) shall be self-contained.
Severity Level:3
Category:Conceptual Models



Self-contained header files can be included in arbitrary order (without implicit dependencies). A self-contained source file explicitly includes all header files from which typedefs, defines, function prototypes etc. are used in the source. Each header file includes those other header files from which it uses typedefs, defines and function references. In this way self-contained source files can be compiled and checked with SQ in isolation, thus before they are used by or integrated with other parts. Especially for interface header files it holds that when the compiler or SQ determine (potential) problems they mostly can be resolved easily before other code developed on basis of the content of these header files is written.


CCBX_header.h header file content:

#include "header/ownbool.h" /* RIGHT: because of ownbool usage */
int CCBX_fn(ownbool b);

and inclusion in .c source file:

#include "header/ownbool.h" /* RIGHT: because of usage of ownbool */
#include "CCBX_header.h" /* RIGHT: because of usage CCBX_fn */
static int ccby_fn(void)
   int e  = OK;
   bool b1 = TRUE; /* #include "header/ownbool.h" needed */

   e = CCBX_fn(b1); /* #include  needed */