[Lazarus] Hints usability (was: Re: Large program size - 1.8 MB for empty GUI project)

Christian Iversen chrivers at iversen-net.dk
Fri Apr 10 01:20:43 CEST 2009


JoshyFun wrote:
> Hello Christian,
> 
> Thursday, April 9, 2009, 7:13:06 PM, you wrote:
> 
> CI> Hint: Something that can't be ruled out as dangerous, but might just be.
> CI> For practical reasons, this category can't be merged with "warnings",
> CI> because that would then produce so many warnings that the only useful
> CI> error category would be "error". That would be bad.
> 
> Yes but an easy way to tell the compiler that the hint or warning is
> expected must exists and I think that {$HINTS OFF} is a too radical
> path.

That's really 2 statements:

A) There should be a way to tell the compiler that the hint is expected

Well, I can't see why this is a given. By definition, hints are things 
that _can_ be potentially dangerous, but it's impossible to determine 
for sure. Warnings point out things which are always potentially dangerous.

Therefore, for hints, you'll just end up with code that's entirely 
plastered in specifications to disable hints. This will make the code 
ugly, and remove time that could be spent better.

For warnings, it should always be considered a problem with the code if 
it generates a warning. If the code is fine, then the compiler is wrong 
for issuing a warning rather than a hint. This is somewhat rare, 
however. I think it's a bit of time since a warning was reclassified 
(but I have seen it happen).

B) Saying {$HINTS OFF} is too radical

Well, I agree it can be bit radical. Perhaps a switch to disable 
certains hints only would work better. Typically, certain hints give you 
more trouble than others, depending on coding style.

> In my case for the "Parameter not used" I'm using a heavily overloaded
> procedure "UseParameter" which does nothing and my code is clear of
> this kind of hints. The problem is that I must updated the
> "UseParameter" each time I use a new parameter type.

I'm not sure what you mean? Can you give a small example?

-- 
Med venlig hilsen
Christian Iversen



More information about the Lazarus mailing list