array[] of char in writeln: compatibility with T.P.
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
In Turbo -compatibility mode, the type
array[1..n] of char should be partially compatible with the type
string[n]
With fpk, the following program does not work as it should:
the array (5 chars) is truncated when used with implicit conversion to string
(explicit conversion works fine)
fpc 0.99.12b dos version
*****************************************************************
var
a:array[1..5]of char;
s:string;
c:char;
i:integer;
begin
{initialization}
c:='A';
for i:=1 to 5 do begin
a[i]:=c;
inc(c);
end;
{explicit conversion to string: OK}
s:=a;
writeln(s);
{implicit conversion: ERROR}
writeln(a);
{implicit conversion, with forced length: OK}
writeln(copy(a,1,5));
writeln('these three lines should be identical: ABCDE');
end.
Additional information:
Reporter: Jean-Pierre VIALjpvial@computer.org
EMail: jpvial at computer dot org
Mantis conversion info:
- Mantis ID: 2628
- OS: All
- Version: ?
- Fixed in version: 0.99.13