Use this tag when question related to unused variables issues as warnings
Questions tagged [unused-variables]
179 questions
0
votes
1 answer
Unused object properties bad?
I have a object list with some properties that dont need .I always include the ones I know I won't use anyway because "maybe I need them later" excuse. Is there a clear answer if this is bad or not? I imagine it is a tiny waste of performance, but…

Rien
- 398
- 2
- 12
- 37
0
votes
1 answer
Why doesn't the compiler raise a warning when a struct member is unread?
I have these 2 pieces of code:
fn main() {
let mut x: int = 5;
x = 6;
println!("value {}", x);
}
With this code, the compiler will raise warning:
the value is never read at let x: int = 5
But with the following code, the compiler…

user3071121
- 605
- 2
- 8
- 12
0
votes
0 answers
Unused local variable compiler error when it is used
I've got a weird one here. I'm getting the compiler error "Unused local variable" for a variable that is used!
If bUpdate Then
Dim fclm As New frmNewClaim : GetOpenForm(fclm)
With fclm ' <-------------------
.something = x
End With
…

JA12
- 61
- 1
- 4
- 12
0
votes
2 answers
C: When is a variable or value considered used?
I am cleaning up some code from a Coverity issue and have a situation where a pointer local to a function is used earlier on is a function for comparison, then later on it is assigned to point else where but it is never de-referenced or used to…

The_Neo
- 308
- 1
- 4
- 13
0
votes
0 answers
Resharper fails to detect unused recursive parameters
I have the following recursive function in C# which has a parameter named "format" which is never used outside of the recursive call.
public static int MyFunction(int c, bool format = false)
{
if(....)
{
MyFunction(c - 1, format);
…

Mikaël Mayer
- 10,425
- 6
- 64
- 101
0
votes
0 answers
Getting unused argument error in created function when argument being used
I have created a function in R called calibrate, with the following call:
calibrate<-function(prior, p1=NULL, p2=NULL, p3=NULL, q13, q23,
accuracy=1e-7, sol=4, data, name_col=1, pval_col=2, tier_col=NULL)
The first thing that occurs in…

hockeyvic06
- 1
- 1
0
votes
4 answers
Remove "unused variable" warinings from C++
I got some code and trying to removing all warning for the given code.
While for certain function like:
sub_main(int /*argc*/, char** /*argv*/){
-------------
obj1* ptr1 = new obj1(xxx);
obj2* ptr2 = obj1->xxxx(xxxx)
-------------
}
While this…

thundium
- 995
- 4
- 12
- 30
0
votes
1 answer
Possibly spurious JSLint unused variable warning
This is the whole file, it's saying: Unused 'callback' which I'm not sure how to work around. Anyone got any ideas?
//////////////////////////////////////////////////////////////////////
/*global window, performance…

Charlie Skilbeck
- 1,081
- 2
- 15
- 38
0
votes
3 answers
How to find unused lists/procedures in scheme?
I am cleaning up some (Chicken) scheme code and I want to identify all lists/procedures not used in a given program. Is there a specific option to pass either to the Chicken compiler or to csi -s I can use to do so without listing out each define…

xuinkrbin.
- 975
- 2
- 7
- 17
0
votes
1 answer
linked list search function
I am developing a C program and I want to use this function to check if an element of type Client with a given number is already inserted. It moves along the list and returns 1 as soon as the number is found, only when I try to compile, it tells me…

Moonlapse Vertigo
- 69
- 3
- 7
0
votes
1 answer
Needed string in program is "unused" C#
I've been making a text adventure game in C# (to learn more about strings and such). I have about 3 random scenarios that are triggered after the 10 basic ones where you start. One of them is the monkey temple. The "menu" class has two arguments,…

Ilan
- 513
- 2
- 8
- 24
0
votes
1 answer
"variable not used" when using const in C#
I've been making a text adventure game and I have these constants that contain the commands available to the players.
For example:
const string ConScenChoiceOne = "hit monkey talk to monkey suicide go inside";
string conchoice1; …

Ilan
- 513
- 2
- 8
- 24
0
votes
0 answers
Why am I getting this incorrect "unused variable" message?
My code looks like this:
-(void)setGuiDisplayMode:(id)mode
{
// constrain inputs
if ( [mode intValue] < 3 && [mode intValue] > -1 ) {
guiDisplayMode=[mode intValue];
} else {
guiDisplayMode=0;
}
NSString *titles[3]={
@"Narg",
…

Betty Crokker
- 3,001
- 6
- 34
- 68
0
votes
1 answer
C++ Error: Wunused-but-set-variable
I get the error I mentioned in the title when I try to compile the following code:
void Sql::select(const string table, const string column, const string condition, const string condition_2, const string condition_3) {
otl_stream…

FRules
- 739
- 1
- 10
- 20
0
votes
5 answers
Unused variable warning in objective c
I'm trying to learn objective-c and have encountered a warning in this example:
#import
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSMutableDictionary *booklisting = [NSMutableDictionary…

monkeyboy
- 1,961
- 2
- 13
- 7