Node: Unwanted Variables, Next: Unused Arguments, Previous: Variables Assumed To Be Saved, Up: Working Programs
The -Wunused
option can find bugs involving
implicit typing, sometimes
more easily than using -Wimplicit
in code that makes
heavy use of implicit typing.
An unused variable or array might indicate that the
spelling for its declaration is different from that of
its intended uses.
Other than cases involving typos, unused variables rarely indicate actual bugs in a program. However, investigating such cases thoroughly has, on occasion, led to the discovery of code that had not been completely written--where the programmer wrote declarations as needed for the whole algorithm, wrote some or even most of the code for that algorithm, then got distracted and forgot that the job was not complete.