[fpc-pascal] TMemoryStream.SetSize question.
gabor at poczta.onet.pl
Mon Jun 14 21:56:25 CEST 2021
W dniu 2021-06-14 o 21:27, Michael Van Canneyt via fpc-pascal pisze:
> On Mon, 14 Jun 2021, gabor via fpc-pascal wrote:
>> Why does TMemoryStream only implement one version of SetSize method?
>> The TStream class has two versions of SetSize method (virtual,
>> overload) - one with a parameter of LongInt type and the other with
>> the Int64 type. Since function is virtual, child classes can override
>> it and can be called from code, but then a version of the SetSize
>> function not implemented for a given platform in the TMemoryStream
>> class can be called.
> The base method checks which one is overridden. So it does not matter
> which one you override in the child.
> The "other" one will always fall back to the method in TStream.
Unfortunately, on the 64bit platform it does not fully work. See the
TMyMemStream = class(TMemoryStream)
MS := TMyMemStream.Create;
More information about the fpc-pascal