Wish: Variable Not Used Warning

Bill Baxter dnewsgroup at billbaxter.com
Wed Jul 9 01:16:35 PDT 2008


Nick Sabalausky wrote:
> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
> news:g51k8s$102f$1 at digitalmars.com...
>> The difference between lint and a compiler is people know lint is not a 
>> compiler and do not worry about lint's complaints. Warnings in the 
>> compiler are treated, in reality, like programming errors.
>>
> 
> Ahh, now this appears to be the root of our differing opinions on this. I 
> think I understand your reasoning behind this now, even though I still don't 
> agree with it.
> 
> It sounds like (previously unknown to me) there's a rift between the reality 
> of warnings and the perceptions that many programmers (excluding us) have 
> about warnings. As I understand it, you consider it more important to design 
> around common perceptions of warnings, even if they're mistaken perceptions 
> (such as warnings, by definition, not actually being errors). My 
> disagreement is that I consider it better to design around the realities, 
> and use a more education-based approach (I don't necessarily mean school) to 
> address misperceptions. Is this a fair assessment of your stance, or am I 
> still misunderstanding?
> 
> If this is so, then our disagreement on this runs deeper than just the 
> warnings themselves and exists on more of a "design-values" level, so I 
> won't push this any further than to just simply note my disagreement. 

I think Walter is right here too.  With Microsoft compilers warnings are 
so copious that they become almost useless.  They warn about piles of 
trivial things that only have a remote possibility of being a bug.   So 
you end up just ignoring them, and in that case they might as well not 
be there.  It's just annoying.

I think the problem is that the compiler writers have this attitude that 
they can be "helpful" by warning about anything that possibly could be a 
bug, even if it's going to have 100 times more false positives than real 
hits.  That's not a good way to do warnings.

By making warnings either off or fatal like D, you force the compiler 
writers to actually think long and hard about whether the warning 
they're thinking to add is really so likely to be a bug that they should 
force the user to change the code.  If it's fairly likely that the coder 
actually knows what they're doing, then that really doesn't justify the 
compiler issuing the warning.  A lint tool fine, but not the compiler.

+1 votes for Walter  :-)

--bb



More information about the Digitalmars-d mailing list