Questions tagged [dead-code]

Dead code is code in the source code of a program which is executed but whose result is never used or a code that can never be reached or used.

Dead code is code in the source code of a program which is executed but whose result is never used or a code that can never be reached or used.

Dead code is waste of computing power and might result of unexpected behavior to the program.

Examples:

int foo (int a, int b)
{
    int c = a + b;  // dead code - executes and result never used 
    return a - b;
}

void foo ()
{
     bool a = true;
     if (!a)
     {
         // dead code - never called
     }
}
238 questions
-1
votes
1 answer

Dead code in lesscss javascript compiler

it looks like there is a bunch of dead code (code that is commented out) in the lesscss javascript compiler code. Is there a reason for this? When downloading right from the website the file is 34kb, after removing the dead code it is 5.78kb (left…
asawilliams
  • 2,908
  • 2
  • 30
  • 54
-1
votes
1 answer

How can I remove dead JS code sent to the browser by PHP?

Well, I made a little research and decided to remove dead code with Tree Shivering, but it turned out that all JS scripts with HTML are sent by PHP to the browser and it doesn't work with npm run build or something. I don't know how to remove dead…
-1
votes
1 answer

Does unreachable Rust code get compiled and included in the final binary?

I'm new to Rust and compiled languages in general. Does every crate I include as a dependency end up in the binary, even if I don't use a single function from that crate? And if I use just a single function from a big library. Does the entire…
Cornelius Roemer
  • 3,772
  • 1
  • 24
  • 55
-1
votes
1 answer

Does anyone know what this yellow underline is coming from? Error message says it's due to "dead code" but I defined the local variable?

enter image description here[enter image description here][2]I have tried getting rid of the local variable and making i increment but x.length() but that produces a yellow underline as well. Does anyone know what I'm missing? public static boolean…
-1
votes
5 answers

for loop has "dead code" at i++

public String toString() { for(int i = 0; i
user9722649
-1
votes
2 answers

Why is the "i++" a dead code here in the below snippet?

While coding with eclipse, the code i++ is shown as a dead code. What does that mean? Why is it being a dead code? public class ScoreCalculator{ public static void main(String[] args) { int ScoreCard[] = {70,102,198, 60}; String…
Monisha Mohan
  • 23
  • 1
  • 2
-1
votes
3 answers

Dead code using android eclipse

I am working on android application in which i am using a logic to find the direction of a person from coordinated. Everything is working fine but i got error at console: : "Dead Code". My code is given below, please explain me this thing. private…
Usman Khan
  • 3,739
  • 6
  • 41
  • 89
-2
votes
1 answer

check unreachable code in most simple way in python

I have a python code with is detect any errors in another python code saved in txt file, i did that i can detect magic numbers and more than 3 parameters in the function, and now i have to check un reachable code, but i don't have an idea how can i…
Talia Dianal
  • 105
  • 1
  • 7
-2
votes
1 answer

Dinstinguish between Development and Production Environment

I would like to be able to distinguish between development and production environment. Use Case I have a huge legacy code base (python) before me. I am unsure whether some methods are still used in production or not. My current strategy I want to…
guettli
  • 25,042
  • 81
  • 346
  • 663
-2
votes
1 answer

what is dead code ?

Here is my code, Eclipse is saying i++ is dead code... why?? for(int i=0;i
-2
votes
2 answers

How do I remove dead code from an EXE file?

Possible Duplicate: Reduce exe file What are some tools that, given an EXE file, remove all unused code and make a new EXE file with code really used by the application? I think that something like that should exist. Just for curiosity; but I…
Marcello Impastato
  • 2,263
  • 5
  • 30
  • 52
-3
votes
3 answers

Dead code warning where it shouldn't be

I have a very simple Java code, like this (this is just an excerpt): for(;;) { AnObject object = null; for(AnObject elem : list) // where the list is of the type List { if() { object =…
Stan
  • 8,683
  • 9
  • 58
  • 102
-4
votes
1 answer

Why would java files not be referenced anywhere?

I know that a reason why java files may not be referenced elsewhere in the code is they may be valid tests which obviously do not need to be referenced elsewhere, but are there any other reasons that there may be java files which exist and are never…
ftlog
  • 11
  • 4
1 2 3
15
16