Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Dead Code is any code that is never executed, or if executed, the execution has no effect on the application's behaviourbehavior.

Lines of code are either not executed or redundant because they

...

DO-178B/ED-12B essentially requires that any Dead Code is removed, and it calls for the verification of Deactivated Code to prove that it cannot be inadvertently activated. Because of this, the cost of testing is very high. Identifying Dead Code is also a good development practice irrespective of certification requirements because studies have shown that Dead Code and Deactivated Code are a source of hidden defects and run-time errors.

Related Guidelines

SEI CERT C++ Coding Standard

VOID MSC07-CPP. Detect and remove dead code

ISO/IEC TR 24772

Unspecified functionality [BVQ]
Dead and deactivated codeĀ [XYQ]

MISRA C:2012

Rule 2.1 (required)

MITRE CWE

CWE-561, Dead code

The presence of Dead Code in your application can lead to serious consequences as it can be a source of hidden bugs. Dead Code also implies that the code is inefficient as it can increase the size of your executable, which is especially relevant for embedded applications. There can also be legal implications and uninteded consequences.

...