Detector for unused variables

Ali Çehreli acehreli at yahoo.com
Mon Jul 30 13:26:05 PDT 2012


On 07/30/2012 12:02 PM, Namespace wrote:

 > there is no reason which stands against a warning for unused variables.
 > Or can you tell me some personal reasons, without quoting Walter?

People comment-out parts of code during development and debugging, 
leaving unused variables behind (just for a while). Receiving 
compilation errors for those is not productive. (Warnings would be the 
same thing as they should be treated as errors.)

Additionally, some unused variables do very important work (e.g. RAII 
structs). Should the compiler warn for only the ones that do not have 
side-effects in their constructors and destructors?

Such questions are not easy to answer.

Ali



More information about the Digitalmars-d-learn mailing list