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

Category: Code Organization

Synopsis:Architectural Issues


Description:

This chapter concerns the organization of code in files. Guidelines for organizing the code makes it easier to find code and can be used to enforce a correct implementation of the system's architecture.

Coding Rules

NameCheckedSynopsis
ORG#001 Checked automatically with code checker Enclose all code in header files within include guards
ORG#002 Each file shall be self-contained
ORG#003 Checked automatically with code checker From a source file include only header files
ORG#004 Classes that are only accessed via pointers (*) or references (&) shall not be included as header files
ORG#005 Each file shall directly include each header file upon which declarations it directly depends
ORG#006 Checked automatically with code checker C++ header files have the extension .h, .hpp or .hxx
ORG#007 Checked automatically with code checker C++ source files have the extension .cpp
ORG#008 Place non-portable code in a special file so that it may be easily located when porting code from one architecture/environment to another
ORG#009 Avoid unnecessary inclusion
ORG#010 Checked automatically with code checker Do not let assertions change the state of the program
ORG#011 Checked automatically with code checker Everything must reside in a namespace
ORG#012 Checked automatically with code checker Never put "using namespace" in header files
ORG#013 Checked automatically with code checker Don't put definitions in header files