In all of this discussion, shouldn't the point be that the passing an un-initialized variable is correctly being reported as a possible error (of limited severity)?
The _proper_ solution is to initialize the variable's contents and then use it. The alternative is to substitute an alternative procedure, like, say, ZeroMemory or write a clever wrapper procedure. One of the features of languages like Pascal is that one's warned of their oversights by the compiler. The alternative is blindingly visible in products like W-----$ and buffer overruns a-plenty in other apps compiled with a language from the hierarchy derived from a language between B and D. Stu Cox (his own opinions) -----Original Message----- From: fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Aleksa Todorovic Sent: Wednesday, November 18, 2009 9:15 AM To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint. On Wed, Nov 18, 2009 at 17:58, Jonas Maebe <jonas.ma...@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). _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal