[fpc-pascal] Warning "Local variable seems to be not initialized" on dyn array

Jürgen Hestermann juergen.hestermann at gmx.de
Tue Mar 10 18:43:46 CET 2015


Am 2015-03-10 um 18:16 schrieb Lukasz Sokol:
> On 10/03/15 16:08, Jürgen Hestermann wrote:
>> Then please tell me, what do you (or anybody else) gain from this warning?
>> Especially, as it claims something that is definitely not true (for managed types).
>> It may even misguide some to add initialisation code without need and
>> it distracts from the realy important messages.
>>
> Just googled this out:
> (edit: meant this actually)
> http://lazarusroad.blogspot.com.br/2012/07/does-it-matter-how-dynamic-arrays-are.html
>
> and this immediately after:
>
> http://lazarusroad.blogspot.co.uk/2012/07/cost-to-supress-warning-and-how-not-pay.html
>
>

I am not sure what these links should tell me.
I could not find any hint that omitting the warnings for managed types would do any harm.
Just the opposite. As I already suspected, people are adding code just to get rid of the warning
(or they have the time and leisure to disable these warnings for each project over and over again):
Cite from the second link:

"Although the performance impact is mostly negligible, is extra code anyway.
In my case i initialize the parameter explicitly so *out* would add redundant code.
There's an alternative to suppress the message: add the directive {%H-} in front of the variable that is being passed to the procedure."

Again I can't find any legimitation for having these warnings.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150310/dd10fe70/attachment.html>


More information about the fpc-pascal mailing list