The Jargon File (version 4.4.7, 29 Dec 2003):
dead code
n.
Routines that can never be accessed because all calls to them have been
removed, or code that cannot be reached because it is guarded by a control
structure that provably must always transfer control somewhere else. The
presence of dead code may reveal either logical errors due to alterations
in the program or significant changes in the assumptions and environment of
the program (see also software rot); a good compiler should report dead
code so a maintainer can think about what it means. (Sometimes it simply
means that an extremely defensive programmer has inserted can't happen
tests which really can't happen ? yet.) Syn. grunge. See also dead, and
The Story of Mel'.
The Free On-line Dictionary of Computing (30 December 2018):
dead code
infeasible path
(Or "infeasible path") Any part of a program
that can never be executed because no control flow path
leads to it. This may be because it is guarded by a control
structure that will always transfer control somewhere else,
e.g.
if (false)
# dead code
or it may be for a less obvious, less local reason, e.g. code
in a function that is only called from another function that
is only called to handle certain input that never occurs in
practice.
Determining that some code is dead may thus require analysis
of the whole program. Consideration of possible inputs is
probably beyond the normal (static) identification of dead
code.
The presence of dead code may reveal either logical errors due
to alterations in the program or significant changes in the
assumptions and environment of the program (see also software
rot). Sometimes it simply represents can't happen tests
inserted by a defensive programmer.
A good compiler should warn about dead code or it may
perform dead code elimination.
[Jargon File]
(2018-08-19)