Hello all,
I got from a Russian FPC forum a sample that demonstrates a strang behavior. That is this sample:
{$ifdef fpc}
{$mode delphi}
{$endif}
{$apptype console}
function Func(const S : string):string;
begin
Result := S;
pchar(Result)^ := succ(pchar(result)^);
end;
var I : integer;
begin
for I:=1 to 3 do
WriteLn(Func('12345 '));
ReadLn;
end.This sample makes permanent changes in a string constant. If this sample will be compiled in Delphi it restores previous constant value (and all calls of the function Func return the same result; Delphi 6) or crashs with RTE 216 (Delphi 3).
