Wish: Variable Not Used Warning

Bruno Medeiros brunodomedeiros+spam at com.gmail
Sun Jul 27 07:10:56 PDT 2008


Bill Baxter wrote:
> 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.
> 

But Visual Studio had the option to disable *specific* warnings either 
globally (in the IDE), or locally (in source code with pragma 
statements). So in my experience with VS C++, even though I did find 
several types of warnings which were fairly useless, I simply disabled 
those kinds of warnings globally, keeping all the others. So I don't see 
a problem here.

> 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

And because I don't see a problem, I also don't find the need to "making 
warnings either off or fatal like D", thus denying the use case where 
you want the compiler to report a code situation which is not 
necessarily "fairly likely" to be a bug, but is still relevant enough to 
report to the coder, for whatever reason.


-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list