
- Software Testing Dictionary
- Home
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Unreachable Code
What is unreachable code?
Unreachable code, a part of the source code that will never be executed due to inappropriate exit points/control flow. The other kind of unreachable code is referred as dead code, although dead code might get executed but has no effect on the functionality of the system.
Example:
Below example clearly shows unreachable code and dead code differences:

Unreachable Code Side Effects:
Unnecessary memory overheads.
Unnecessary caching cycles which leads to performance bottlenecks.
Documenting and Maintaining overheads.
Unreachable Code Causes:
Programming errors while developing complex conditional branches.
Incomplete unit testing because of which unreachable code was undetected.
Redundant code that developer forgot to delete
The code that might be programmatically correct but won't be executed at any point of time due to the input data that is passed to the function.