Loop over anonymous array cap string length to first element
Original Reporter info from Mantis: tennis
-
Reporter name: Runar Tenfjord
Original Reporter info from Mantis: tennis
- Reporter name: Runar Tenfjord
Description:
A simple loop over anonymous array of strings will cap the string length
to the length of the first element.
This code compiles without any warning.
In addition the $H+ mode is selected and it seems ShortString is returned.
Steps to reproduce:
Code:
program stringlooptest;
{$mode objfpc}{$H+}
var
name : string;
begin
for name in ['project','customer','supplier'] do
WriteLn(name);
end.
Returns:
project
custome
supplie
e.g. last element has capped length.
Mantis conversion info:
- Mantis ID: 37338
- OS: Windows
- OS Build: 10
- Platform: 32bit
- Version: 3.2.0