If you compile the following program with Delphi 10.2.3 Tokyo
{$apptype console}
var
spi: string;
begin
str(pi:10:5, spi);
writeln(spi);
end.
then you get the warning:
tst.pas(5) Warning: W1057 Implicit string cast from 'ShortString' to 'string'
although spi is declared as string and the prototype of system.str also has a string (according to http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.Str and the online help):
procedure Str(const X [: Width [:Decimals]]; var S: String);
but the actual code with debug dcu calls this function:
function _Str2Ext(val: Extended; Width, Precision: Integer): _ShortStr;
Obviously the compiler does some kind of magic here, but is this a bug in the documentation or in compiler?
How can I get rid of this warning by coding (not by suppressing warnings), the first try
str(pi:10:5, ShortString(spi));
will throw an error message:
tst.pas(5) Error: E2064 Left side cannot be assigned to
Interestingly there is no Left side.