Ondrej Pokorny <laza...@kluug.net> schrieb am Di., 3. Juli 2018, 22:57:
> On 03.07.2018 22:08, Florian Klämpfl wrote: > > Am 03.07.2018 um 21:30 schrieb Ondrej Pokorny: > >> On 03.07.2018 20:54, Florian Klämpfl wrote: > >> program Project1; > >> type > >> TMyArray = array[0..10] of Integer; > >> procedure Init2(var A: TMyArray); > >> begin > >> A[2] := 1; > >> end; > >> var > >> A: TMyArray; > >> begin > >> Init2(A); > >> end. > >> > >> should not emit the warning because A is not being read in Init2. > > > > (please note it throws only a hint in this case as A *is* initialized > > as it is a global variable). > > > > FPC has no global data flow analysis (and I do not plan to do so yet), > > so this is warning is currently far out of reach. > > Doing it for SetLength/FillChar would be a good start. > As Florian already wrote: FillChar() is nothing special. It's merely an ordinary procedure with an untyped var parameter. The compiler can't make any assumptions about what the code inside is doing with the parameter. Regards, Sven >
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel