TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
 
C++ Coding Standard
Search

Rule:  POR#021Checked automatically with code checker

Synopsis:Avoid the use of conditional compilation
Language:C++
Severity Level:6
Category:Portability


Description:

Conditional compilation makes the flow of control harder to follow, and has ill effects on testability. Platform dependencies should be handled using platform specific shadow files, preferably located in a general platform building-block.

exceptions:

  • Conditional compilation of header by means of include guards: [ORG#001].
  • Conditional application of platform dependent pragmas: see [POR#018].

An example of the last exception is:

  #ifdef VXWORKS
    #pragma SETPLATFORMSPECIFICOPTION
  #endif