[fpc-pascal] Re: ReadLn issues a warning
Gerhard Scholz
gs at g--s.de
Fri May 20 11:03:00 CEST 2005
Hello,
this is a general feature when using an uninitialized variable as a VAR
parameter.
The compiler cannot know if the called routine needs the parameter values,
or if the parameter is only used to return values back to the caller.
So, I think, a warning here could be helpful (in the case of READ(LN ) not
of course, but in other cases).
Greetings
Gerhard
Date: Sat, 14 May 2005 12:12:50 +0200 (CEST)
From: Michael Van Canneyt <michael at freepascal.org>
Subject: Re: [fpc-pascal] ReadLn issues a warning
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Message-ID: <Pine.LNX.4.61.0505141211221.8264 at home.wisa.be>
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Sat, 14 May 2005, Yiannis Dondos wrote:
> Hello everybody,
>
> could you please tell me if there is something wrong with the following
> code:
>
> program test1;
>
> var
> f: Text;
> i: Integer;
> s: ShortString;
>
> begin
> Assign (f, 'test.dat');
> Reset (f);
>
> ReadLn (f, i);
> ReadLn (f, s); // Warning: Variable not initialized
>
> Close (f);
> end.
>
> FPC 1.9.8 on Linux issues a warning that FPC 1.0.10 never did.
> The question is why the string variable needs to be initialized?
It does not need to be. The warning is bogus. This is a bug.
Michael.
More information about the fpc-pascal
mailing list