Dead code

This is an old revision of this page, as edited by 66.90.148.86 (talk) at 08:32, 5 July 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer programming, dead code consists of blocks of programming instructions or entire 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. Many times dead code is inserted by a defensive programmer for can't happen tests that really can't happen (yet). Other times dead code is inserted by the programmer for debugging purposes but has yet to be removed.