[fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.

Aleksa Todorovic alexionne at gmail.com
Wed Nov 18 18:15:05 CET 2009


On Wed, Nov 18, 2009 at 17:58, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> What is the problem with fillchar? (other than that it prints a wrong hint in some cases.
>
> Also note that the difference between hints and warnings is exactly that hints are not guaranteed to be 100% correct or relevant in all situations; if they were, then they would be warnings. Hints are mainly intended to help you scrutinise your code more closely in case there's a problem you can't find, by flagging things that *might* indicate a problem. Getting all code hint free is probably not even possible (or desirable).
>

You're completely right about that - there is nothing _wrong_ about
fillchar. But if you have fillchar in, say, 20 places in your code,
then you'll have to check all of those 20 places every time you build
your project. And the idea of notices and hints is they are not to be
ignored, but checked, isn't it? :-)

As of myself, I don't really care if there will be new
safe_fillchar_with_no_hints function or not - it is easy to
encapsulate fillchar, as JoshyFun pointed out. Aside from that,
fillchar is unsafe by its nature, so having hint whenever one uses it
is good idea (as a side effect of uninitialized variable in this
case).



More information about the fpc-pascal mailing list