Michael Van Canneyt wrote:
If you do an exception or silent change of position it can cause
incompatibilities. Maybe read operation must be fixed to ignore positions out
of the range 0..Size -1?

What does Delphi do in such a case ?
Tested so:

procedure TForm1.Button1Click(Sender: TObject);
var
 S: TMemoryStream;
 B: Byte;
 Count: Integer;
begin
 S := TMemoryStream.Create;
 B := 1;
 S.Write(B, SizeOf(B));
 S.Position := -1;
 Count := S.Read(B, SizeOf(B));
 ShowMessage(IntToStr(Count));
 S.Free;
end;

Count = 0. IOW, delphi does not read if position < 0

Best regards,
Paul Ishenin.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to