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

Sven Barth pascaldragon at googlemail.com
Tue Mar 10 14:54:22 CET 2015


Am 10.03.2015 13:05 schrieb "Lukasz Sokol" <el.es.cr at gmail.com>:
>
> On 10/03/15 09:08, Mattias Gaertner wrote:
> > On Tue, 10 Mar 2015 08:48:49 +0000
> > Lukasz Sokol <el.es.cr at gmail.com> wrote:
> >
> >> On 10/03/15 06:10, J├╝rgen Hestermann wrote:
> >> [...]
> >>> Why not simply omit these messages (for managed types)?
> >>
> >> Just because YOU don't need it, doesn't mean it's useless for
everybody...
> >>
> >> http://www.freepascal.org/docs-html/prog/progsu80.html#x87-860001.2.80
> >>
> >> why not just use this to suppress the warning JUST where you DO know
it's not needed?
> >>
> >> (you can suppress warning by number too IIUC).
> >
> > Yes.
> > For example in Lazarus 1.3+ you can right click the message and
> > click on "Hide with project option (-vm5089)".
>
> Cool, but probably not what I meant ;) as this hides it project-wide ?
>
> I mean, it's good to have this warning enabled by default and only
suppress it around code
> that /I/ know it's bogus at. Otherwise, it /really/ wouldn't serve its
purpose of pointing
> where a PEBKAC^WLOGIC ERROR may occur...
>
> Sort of like surround the variable declaration with
> {$WARN IDENTIFIER OFF}
> {$WARN IDENTIFIER ON}  explicitly (then have code tools fold it so it
won't pinch our eyes ;) )

Note: you should use the sequence
{$push}{$warn xyz off}bla{$pop} as otherwise you would enable the warning
if it was disabled from the command line parameters or the configuration.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150310/a0850717/attachment.html>


More information about the fpc-pascal mailing list