could you please tell me if there is something wrong with the following code: program…
Yiannis Dondos wrote 24 lines
It does not need to be. The warning is bogus. This is a bug.
Michael.

Mailing lists / fpc-pascal / 2005-05
5 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
could you please tell me if there is something wrong with the following code: program…
It does not need to be. The warning is bogus. This is a bug.
Michael.
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? And if it does, then why the integer variable does not issue the same warning?
Thanks in advance,
Yannis.
It does not need to be. The warning is bogus. This is a bug. Michael.
The warning is a feature when you call your own made functions. For functions like readln() this shouldn't be triggered. Please report it as a bug.
Peter
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
Subject: Re: [fpc-pascal] ReadLn issues a warning
To: FPC-Pascal users discussions
Message-ID:
Content-Type: TEXT/PLAIN; charset=US-ASCII
It does not need to be. The warning is bogus. This is a bug.
Michael.
It is a known issue for Readln() and Str(). The routines need to be changed from 'var' to 'out'. But changing it short before the release was too risky.