[fpc-devel]Pchar issue on Win32 with 1.9.2

Skovrup, Morten Juel ms at mek.dtu.dk
Fri Jan 16 14:06:01 CET 2004


I couldn't get in contact with the bug-report system, but the following
code behaves incorrectly (compiled using -Sd):

program TestConsole;

var
  AStr,BStr : string;
  
procedure WriteStr(p1,p2 : PChar);
begin
  WriteLn(p1,p2);
end;

begin
  AStr := 'Hel';
  BStr := 'Hi';
  //The following outputs 'Hello Hello'
  WriteStr(PChar(AStr+'lo '),PChar(BStr+'Hi'));
  //The following outputs 'Hello Hi Hi'
  WriteStr('Hello',' Hi Hi');
  ReadLn;
end.

Regards
Morten




More information about the fpc-devel mailing list