Unused variables, better as error or warning?

Walter Bright newshound2 at digitalmars.com
Fri Aug 20 15:13:51 PDT 2010


bearophile wrote:
> On the other hand, in a hairy C program of mine I have defined a counter
> variable, and then I have forgotten to use it, the unused variable warning
> given by GCC has given me a hint, and I have quickly fixed the code in few
> seconds.

Not every problem is worth using a sledgehammer to deal with.


> The alternative is then to do as I think Go has done, and turn unused 
> variables into errors. And then you need a way (like a pragma) to locally 
> disable this error when you are debugging (and this is not nice), or when you
>  generate code automatically (this is acceptable).

I've used pragmas to turn of warnings before. Sorry, but "bleh".


More information about the Digitalmars-d mailing list