[fpc-pascal] Blockread and buffers
Peter J. Haas
fpc.ml at pjh2.de
Thu Mar 24 01:13:26 CET 2005
on 2005-03-23T22:16:26+02:00 Jeffrey wrote:
> However, the example below gives me a similar warning
> with 1.9.8, but not 1.9.6:
I don't get such a warning with a version some days ago.
> program vdnstbi;
> str(16, s); // Variable "s" does not seem to be initialized
> Does "S" really need to be initialized ?
It is the same problem like BlockRead. In TurboPascal there exist only
two variants of parameters, call by value and call by reference. Call
by value parameters are always input-only parameters. Call by
reference parameters can be input-only parameter, input/output
parameter or output-only parameter, the compiler can not differentiate
Since Delphi there exists two more parameter variants: const and out.
const do mean, that the function don't change the parameter, it is
input-only parameter. out do mean, that the parameter is a output-only
parameter. Now the compiler can differentiate and generate dependable
I don't know, whether other compiler modes support const and out. If
yes, the RTL/FCL/LCL functions should use it. This do mean e.g.
procedure int_str(l: longint; out s: string);
procedure int_str(l: longint; var s: string);
More information about the fpc-pascal