I would like to know why an unused variable is bad.
Is it because the compiler would create a bigger binary? If yes, is there a tool/script which can add an unused keyword or something like that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The compiler gives you warnings to hint on things that could potentially be a problem or unintentional.
Unused variables will be optimized away most likely. But maybe you intended to do something with them – and in that case the compiler helpfully notes that you may have done something you didn’t want.
What’s the use in a variable you declare but neither read from nor write to?