thanks for the explaination. (It is the expected behaviour according to type definition, but is it the desired behaviour ?
)
Well, feel free to open a bug report to add a type helper for
Real as well.
We can say that "tostring" is less portable than "/floattostr/flrotstrF/etc.." family. Having code with double and a lot of "tostring" if the type is changed to real casues a lot of compiler errors.
Real is simply a legacy type from TP times and considering that Delphi tends to ignore legacy types and that type helpers are a concept introduced by Delphi there was simply no type helper added for
Real.
but this works
procedure TForm1.Button5Click(Sender: TObject);
var
a : real;
b : double;
c : string;
begin
c:=FloatToStr(a); //<--- this compile
c:=b.tostring;
end;
Because the compiler can convert
Real to
Double, but for declaring overloads and for type helpers an exact type match is necessary.