In computer programming, unreachable code is part of the source code of a program which can never be executed because there exists no control flow path to the code from the rest of the program.
Unreachable code is sometimes also called dead code, although dead code may also refer to code that is executed but has no effect on the output of a program.
Unreachable code is generally considered undesirable for a number of reasons, including:
- Occupies unnecessary memory
- Causes unnecessary caching of instructions into the CPU instruction cache - which also decreases data locality.
- From the perspective of program maintenance; time and effort may be spent maintaining and documenting a piece of code which is in fact unreachable, hence never executed.
Read more about Unreachable Code: Causes, Examples, Analysis
Famous quotes containing the word code:
“Motion or change, and identity or rest, are the first and second secrets of nature: Motion and Rest. The whole code of her laws may be written on the thumbnail, or the signet of a ring.”
—Ralph Waldo Emerson (18031882)