Jonathan M Davis:

> The problem is that there are a lot of things that you can warn about which 
> aren't necessarily a problem, and it can be really annoying to have to fix a 
> bunch of useless warnings. If it really matters, then it should be an error. 
> And 
> if it doesn't really matter, then do we need to warn about?

This is a quite manichaean view of the programming world, but life isn't like 
that, it comes in shades of grey. I suggest you to read the book "Fuzzy 
Thinking: The New Science of Fuzzy Logic" by Bart Kosko, to help your mind grow 
up a bit.

And sometimes even when the situation is clear for a human, a less smart 
compiler may be unsure, so it has to give a probability weighting of the 
situation. Some lint tools literally partition their messages in classes based 
on their truth probability.

And then, keep in mind I was not talking about warnings in this post, but more 
about compiler tips. A performance tip, even when it's 100% certain, is not 
something you must listen to. It may be useful if you are performance-tuning a 
function, otherwise you may ignore it. This is why I have said they are a third 
kind of compiler message.


> I'm not entirely against warnings, but I do think that there are a lot of 
> things 
> that keep getting proposed as warnings (particularly by Bearophile) which are 
> far more likely to be annoying to fix non-problems than to actually be a 
> problem 
> and that such warnings would be far better suited to a lint-like tool than 
> the 
> compiler.

There are two things to say about lint tools:
- They are really really useful if you write C code. And I think they may be 
useful for D code too.
- Lot of people aren't using them. I know older programmers that didn't even 
know what a lint is. In my opinion one way to avoid this is to put some 
lint-capabilities inside the compiler.

Putting a whole lint inside the compiler is probably not a good idea, because 
they a good lint is complex. So I think it's a good thing to put some simple 
lint functionality inside the dmd compiler. In Bugzilla I have added some 
enhancement requests about this, that have received many comments from people.

Bye,
bearophile

Reply via email to