Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Dead code
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Analysis == [[Dead-code elimination]] is a form of [[compiler optimization]] in which dead code is removed from a program. Dead code analysis can be performed using [[live-variable analysis]], a form of [[static program analysis|static-code analysis]] and [[data-flow analysis]]. This is in contrast to unreachable code analysis which is based on [[control flow analysis|control-flow analysis]]. The dead-code elimination technique is in the same class of optimizations as [[unreachable code]] elimination and [[redundant code]] elimination. In large programming projects, it is sometimes difficult to recognize and eliminate dead code, particularly when entire modules become dead. Test scaffolding can make it appear that the code is still live, and at times, contract language can require delivery of the code even when the code is no longer relevant.<ref>[[Douglas W. Jones]] [http://catless.com/Risks/8.19.html#subj2 Dead Code Maintenance, Risks 8.19 (Feb. 1, 1989)] {{Webarchive|url=https://web.archive.org/web/20110708124114/http://catless.com/Risks/8.19.html#subj2 |date=2011-07-08 }}</ref> Some [[Integrated development environment|IDE]]s (such as Xcode, Visual Studio 2010<ref>[http://blogs.msdn.com/b/habibh/archive/2009/07/31/discover-dead-code-in-your-application-using-code-analysis.aspx Habib Heydarian, Microsoft Corp]</ref> and Eclipse Galileo<ref>[http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm Eclipse Developer Guide]</ref>) have the ability to locate dead code during the compiling stage. While most optimization techniques seek to remove dead code in an implementation, in extreme forms of optimization for size it may sometimes be desirable to deliberately introduce and carefully shape seemingly dead code, when it allows to fold otherwise unrelated code sections together (and thereby reduce their combined size) so that the extra code will effectively not harm the first path of execution through the code but is used to carry out the actions necessary for the alternative paths of execution, for which other sections of the code may become dead code. On a more functional level, this can be seen as both, artificially introduction of harmless/useful side-effects and reduction of the redundancy of the code, but it can also be used down to opcode level in order to allow the usage of shorter instructions, which would not be possible when folding code sequences without the concerted introduction of side-effects caused by the dead code.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)