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!
{{Short description|Computer code that is never executed}} The term '''dead code''' has multiple definitions. Some use the term to refer to code (i.e. instructions in memory) which can never be executed at run-time.<ref>{{Cite web |url=https://www.cs.bu.edu/~hwxi/academic/papers/padl99.pdf |title=Hongwei Xi, Dead Code Elimination through Dependent Types |access-date=2020-05-06 |archive-date=2012-03-10 |archive-url=https://web.archive.org/web/20120310002543/http://www.cs.bu.edu/~hwxi/academic/papers/padl99.pdf |url-status=dead }}</ref><ref>[http://www.do178site.com/do178b_questions.php] {{Webarchive|url=https://web.archive.org/web/20200520200130/http://www.do178site.com/do178b_questions.php |date=2020-05-20 }} DO-178B</ref><ref>[[DO-178B]] Wikipedia/DO-178B.</ref> In some areas of [[computer programming]], '''dead code''' is a section in the [[source code]] of a program which is executed but whose result is never used in any other computation.<ref>[http://doi.acm.org/10.1145/349214.349233 Debray, S. K., Evans, W., Muth, R., and De Sutter, B. 2000. Compiler techniques for code compaction. ACM Trans. Program. Lang. Syst. 22, 2 (Mar. 2000), 378β415.]</ref><ref>[[Andrew Appel|Appel, A. W.]] 1998 Modern Compiler Implementation in Java. Cambridge University Press.</ref> The execution of dead code wastes computation time and memory. While the result of a dead computation may never be used, it may raise [[Exception handling|exceptions]] or affect some global state, thus removal of such code may change the output of the program and introduce unintended [[software bug|bugs]]. Compiler optimizations are typically conservative in their approach to dead-code removal if there is any ambiguity as to whether removal of the dead code will affect the program output. The programmer may aid the compiler in this matter by making additional use of [[Method (computer programming)#Static methods|static]] and/or [[Inline function|inline]] functions and enabling the use of [[link-time optimization]].
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)