Typecasting array of char to string cuts off last character
Original Reporter info from Mantis: dezlov
-
Reporter name: Denis Kozlov
Original Reporter info from Mantis: dezlov
- Reporter name: Denis Kozlov
Description:
Typecasting array of char to string cuts off last character. This occurs in FPC, but not in Delphi 7.
Not sure if it is by design or a bug, either way it is an inconsistent behavior between two compilers.
Example code is in the "Additional Information" section.
Output when compiled with Delphi 7:
TEST=TEST
Output when compiled with FPC 2.6.4:
TEST=TES
Additional information:
==================================
program project1;
const
Str = 'TEST';
var
Data: array of Char;
begin
SetLength(Data, Length(Str));
Move(Str[1], Data[0], Length(Str));
WriteLn(Str, '=', String(Data));
ReadLn;
end.
==================================
Mantis conversion info:
- Mantis ID: 27530
- Version: 2.6.4
- Monitored by: » dezlov (Denis Kozlov)