Dead code: Difference between revisions

Content deleted Content added
Rescuing 3 sources and tagging 0 as dead. #IABot (v2.0beta15)
Other definitions are used as well - notably by the FAA.
Line 1:
The term '''dead code''' has multiple definitions.
In [[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.
Some use the term to refer to code (i.e. instructions in memory) which can never be executed at run-time.<ref>[https://www.cs.bu.edu/~hwxi/academic/papers/padl99.pdf Hongwei Xi, Dead Code Elimination through Dependent Types]</ref><ref>[http://www.do178site.com/do178b_questions.php] DO-178B</ref><ref>[https://en.wikipedia.org/wiki/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]].