[fpc-devel] StrPLCopy with MaxLen=0

LacaK lacak at zoznam.sk
Thu May 14 14:07:21 CEST 2015


Hi,

When I run this simple program in Delphi:

============================================
program bug_StrPLCopy;

{$APPTYPE CONSOLE}

uses
   SysUtils;

var
   Buf: array[0..10] of Char;

begin
   Buf[0] := 'A';
   writeln(ord(Buf[0]));
   StrPLCopy(Buf, '', 0);
   writeln(ord(Buf[0]));
   readln;
end.

============================================
Delphi Output is:
65
0

In FPC Output is:
65
65

So for MaxLen = 0 nothing happens.

In function StrPLCopy there is:
   if (Result <> Nil) and (MaxLen <> 0) then
     ...

Is it bug?
-Laco.




More information about the fpc-devel mailing list