dead-code Questions
1
I use Vite bundler and in my code I have the following function:
function doSomething() {
if (!import.meta.env.VITE_SOMETHING) {
return;
}
console.log("Hello");
}
I would expect tha...
Bioplasm asked 11/10, 2022 at 12:50
2
Solved
Say I have a function
void do_something() {
//....
#ifdef FEATURE_X
feature_x();
#endif
//....
}
I can compile and run this with no problems; if I want the feature I can pass -D FEATURE_X a...
6
Solved
So you've got some legacy code lying around in a fairly hefty project. How can you find and delete dead functions?
I've seen these two references: Find unused code and Tool to find unused function...
Yamauchi asked 28/3, 2009 at 16:42
7
There is an inspection "Unused declaration" which can find all unused code in Intellij Idea. (see How to use IntelliJ IDEA to find all unused code?)
But I want to find all unused classes,...
Accentuate asked 20/3, 2014 at 2:3
19
Solved
I have legacy C++ code that I'm supposed to remove unused code from. The problem is that the code base is large.
How can I find out which code is never called/never used?
Joyjoya asked 27/1, 2011 at 7:59
1
Solved
When a function is only called from tests rust complains that it is never used. Why does this happen and how to fix this?
Example:
https://play.rust-lang.org/?version=stable&mode=debug&edit...
3
Solved
I tried the following in Eclipse:
if (false) {}: warning 'dead code'
while (false) {}: compilation error 'unreachable code'
I was wondering whether there is a real 'reason' for this difference....
Washbowl asked 30/11, 2013 at 11:54
8
Solved
In order to refactor a client-side project, i'm looking for a safe way to find (and delete) unused code.
What tools do you use to find unused/dead code in large react projects? Our product has be...
Malamut asked 11/1, 2019 at 14:47
7
tl;dr: Can it be ensured somehow (e.g. by writing a unit test) that some things are optimized away, e.g. whole loops?
The usual approach to be sure that something is not included in the production ...
Untread asked 7/8, 2019 at 15:40
2
Solved
I've got some unused functionality in my codebase, but it's hard to identify. The code has evolved over the last year as I explore its problem space and possible solutions. What I'm needing to do i...
Shieh asked 23/8, 2013 at 18:28
4
Solved
How can I detect dead code in my C# application?
1
Is it correct to assume that V8 will completely eliminate the dead code, structured like the following?
File module1.js
export const DEBUG = false
File module2.js
import { DEBUG } from './module1....
Perverted asked 27/5, 2020 at 15:43
1
Solved
I am reading LinkedHashMap source code in JDK 11 and I found a piece of dead code(I'm not sure)
As we all know, LinkedHashMap use a doubly linked list to preserve the order of all the elements.It ...
Madelon asked 6/5, 2020 at 11:52
8
We are refactoring a legacy web app and as a result are "killing" quite a lot of JavaScript code but we're afraid of deleting what we think is dead code due to not being sure. Is there any tool / t...
Waldon asked 9/11, 2010 at 17:41
1
Given a Spring configuration that exclusively contains eager (non-lazy) singleton beans, i.e. the defaults, is it possible to have Spring throw an exception in the case where any of those beans is ...
Frerichs asked 16/3, 2016 at 22:51
2
Solved
I have following code:
public String myMethod(String keyValue) {
Map<String, Integer> keyValueToRowIndex = ...
Integer rowIndex = (keyValue == null) ? 0 : keyValueToRowIndex.get(keyValue);...
2
Solved
Suppose I have the following files:
libmy_static_lib.c:
#include <stdio.h>
void func1(void){
printf("func1() called from a static library\n");
}
void unused_func1(void){
printf("printing ...
Stalky asked 15/6, 2018 at 19:26
7
Solved
I have a large legacy C++ project compiled under Visual Studio 2008. I know there is a reasonably amount of 'dead' code that is not accessed anywhere -- methods that are not called, whole cla...
Betteann asked 26/11, 2008 at 16:7
2
I am attempting to carry out liveness analysis and in order to do so I need to obtain the def and use sets for all of my nodes, where they are defined as follows:
def[n] = set of all variables de...
8
Solved
I'm working with an inherited code base which contains thousands of lines of commented out code. I know the previous coder meant to save all his hard work for posterity rather than simply deleting ...
8
Solved
Consider the following statement:
*((char*)NULL) = 0; //undefined behavior
It clearly invokes undefined behavior. Does the existence of such a statement in a given program mean that the whole pr...
Bilbao asked 18/4, 2014 at 11:44
21
Solved
What tools do you use to find unused/dead code in large java projects? Our product has been in development for some years, and it is getting very hard to manually detect code that is no longe...
Dysphemism asked 2/10, 2008 at 14:22
2
Solved
I think about conditionals and compilers. I am programming an application for Arduino and so I need the application to be as fast as possible.
In my code I have this:
#define DEBUG false
...
i...
Veranda asked 19/8, 2016 at 8:34
3
Solved
consider the following code:
@Test
public void testDeadCode() {
letsThrow();
System.out.println("will never be reached");
}
private final void letsThrow() {
throw new RuntimeException("guess ...
8
Solved
Does anyone know why:
public void foo()
{
System.out.println("Hello");
return;
System.out.println("World!");
}
Would be reported as an "unreachable error" under Eclipse, but
public void foo(...
Blevins asked 26/1, 2010 at 17:1
1 Next >
© 2022 - 2024 — McMap. All rights reserved.