[fpc-pascal] String concatenation failure (again)
Jürgen Hestermann
juergen.hestermann at gmx.de
Tue Aug 2 12:25:41 CEST 2016
I just came accross another issue of string concatenation within my program
that worked okay before FPC 3 but fails after updating to FPC 3.
I had not used this function since the update so I found the problem
only now (by accident):
------------------------------------------
type MyStringType = string;
var S : MyStringType;
Liste : array of MyStringType;
i : SizeInt;
begin
[..] // "Liste" is setup with many string entries (which are also shown correctly with Ctrl+F7 (evaluate/modify)
S := '';
for i := Low(Liste) to High(Liste) do
S := S+Liste[i]+LineEnding;
SetLength(Liste,0);
ShowMessage(S);
end;
------------------------------------------
"S" now always consists of only one line
even when "Liste" has many more.
The for-loop is passed multiple times
as expected but only the first pass adds
a line to "S".
Any idea why this code no longer works?
More information about the fpc-pascal
mailing list