[fpc-devel] Omit hint/warning for a fixed-size array
Michael Van Canneyt
michael at freepascal.org
Fri Aug 31 11:24:46 CEST 2018
On Thu, 30 Aug 2018, Ondrej Pokorny wrote:
> Hello,
>
> is there a way not to get a "Variable xyz does not seem to be
> initialized" hint/warning for a fixed-size array?
>
> program Project1;
> uses Classes;
> var
> Buffer: array[0..255] of Byte;
> FS: TFileStream;
> begin
> // FillByte(Buffer, Length(Buffer), 0); // project1.lpr(9,18) Hint:
> Variable "Buffer" does not seem to be initialized
> FS := TFileStream.Create('test.test', fmOpenRead);
> FS.Read(Buffer[0], Length(Buffer)); // << project1.lpr(11,11) Hint:
> Variable "Buffer" does not seem to be initialized
> end.
>
> What is the correct code that doesn't emit any hint or warning?
Type
TByteBuffer = array[0..255] of Byte;
Var
Buffer : TByteBuffer;
begin
Buffer:=Default(TByteBuffer);
end.
Michael.
More information about the fpc-devel
mailing list