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

Jürgen Hestermann juergen.hestermann at gmx.de
Mon Mar 9 18:43:12 CET 2015

Am 2015-03-09 um 18:31 schrieb Jonas Maebe:
> On 09 Mar 2015, at 17:49, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:
>> Am 2015-03-09 um 17:40 schrieb Jonas Maebe:
>>> http://bugs.freepascal.org/view.php?id=24601#c75617 (and the comment below + use -vq to see warning numbers, and -vmXXXX to block a particular warning number).
>> Thanks for the answer.
>> But still: Why is there such a warning for managed types at all?
> That is the same question you asked in your original mail and which is answered in the bug report comment I linked in reply.

Not quite. In the bug comment you wrote:

The warning is by design for all kinds of variables and regardless of their storage location (as noted by the original submitter, global/static variables of any kind are always initialised by 0/nil/...). The warning means that no value has been explicitly assigned to these variables (which may indicate a logic error in the code), not necessarily that they contain an unpredictable value.

But still there is the question *why* this design exists?
I think it is a bad design.
It should know that managed types *are* initialized and not raise a warning in this case.
Why generate a warning with an incorrect statement?
Am I forced to add (superfluous) initialization code or somehow suppress this kind of
warning just to get rid of this false warnings which are useless from the beginning?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150309/8ebc32b8/attachment.html>

More information about the fpc-pascal mailing list