Dead Code

What is dead code? Explain in programmatic way?

Questions by krishnareddy.pelleti

Showing Answers 1 - 7 of 7 Answers

Dead code is a computer programming term for code in the source code of a program which is executed but whose result is never used in any other computation.[1][2] The execution of dead code wastes computation time as its results are never used.


Regards,
Kapil

  Was this answer useful?  Yes

surendrap

  • Nov 21st, 2011
 

dead code is such a collection of lines of code or code which executes but it its result does not have any significance or affect on output.

  Was this answer useful?  Yes

Hi
Dead code (a.k.a Unreachable code),as the name suggests is the portion of the code which is never executed.
Point out the word NEVER , as the code above that made the break before that and the execution of that never come.
Ex:
int function(a,b)
{
int z;
return a+b;
z=a*b; //It will never be executed
}

The above is the example for a Statement . There might a big function which is never executed.In larger programs 5-10% of dead code can be found.

Note : If a program is smaller in size error code can be checked manually.But for larger program we have automated tools like: TrueCoverage etc

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions