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 <[EMAIL PROTECTED]>
Subject: Re: [fpc-pascal] ReadLn issues a warning
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Message-ID: <[EMAIL PROTECTED]>
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.



_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to