C - Check for unused variables and defines
Robert Lewis last edited by
Is there a way or extension that can check for variables and definitions defined but not used? I am using Npp and Source Cookifier. I am just learning the plugins and also loaded linter, but it does seem to do anything.
Thanks in advance
Ekopalypse last edited by Ekopalypse
Is there a way or extension that can check for variables and definitions defined but not used?
Depending on the compiler used you can have different warnings set.
See, for example for gcc, https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html.
Alan Kilborn last edited by
To elaborate on what Eko is meaning is that you would set up a compiler to run a compile on your source file, and produce output for you which would indicate your “unused variables” in an output window.
Ideally the output window has clickable links which would take you to the point of the problem in your original source code.
This would be a “manual run” kind of thing; if you were looking for something that would be an “as you type” solution, I think you’re out of luck.
There is some good info in this vein to be found HERE.