Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-04

round(variant) needs type cast

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vincent Snijders

Hi,

I have the following program:
program project1;
{$mode objfpc}{$H+}
var
   v: variant;
   d: double;
begin
   v := 3.3;
   d := Round(v);
   v := d;
end.

If I compile this on win32, then there is no problem. If I compile this on win64, I get the following error:
project1.pas(11,8) Error: Can't determine which overloaded function to call

If change line 11 to

   d := Round(round(v));

the error disappears.

Why does the same source compile on win32, but fail on win64?

Vincent

Reply by email

Vincent Snijders
to Vincent Snijders
Vincent Snijders wrote 23 lines
Hi, I have the following program: program project1; {$mode objfpc}{$H+} var v: variant; d: double; begin v := 3.3; d := Round(v); v := d; end. If I compile this on win32, then there is no problem. If I compile this on win64, I get the following error: project1.pas(11,8) Error: Can't determine which overloaded function to call If change line 11 to d := Round(round(v));
I mean:
   d := Round(double(v));
the error disappears. Why does the same source compile on win32, but fail on win64?

Vincent

Reply by email

Jonas Maebe
to Vincent Snijders: I have the following program: program project1; {$mode objfpc}{$H+} var v: variant; d:…
Vincent Snijders wrote 10 lines
If I compile this on win32, then there is no problem. If I compile this on win64, I get the following error: project1.pas(11,8) Error: Can't determine which overloaded function to call If change line 11 to d := Round(round(v)); the error disappears. Why does the same source compile on win32, but fail on win64?

Because we do no support the extended type on win64, and the priority for overload choosing between double and currency is the same for variants (as in Delphi), and there is a round(double) and a round (currency). You get the same error on any non-x86 platform as well.

Jonas

Reply by email

Micha Nelissen
to Jonas Maebe
Jonas Maebe wrote 9 lines
On 16 apr 2007, at 23:14, Vincent Snijders wrote: > Why does the same source compile on win32, but fail on win64? Because we do no support the extended type on win64, and the priority for overload choosing between double and currency is the same for variants (as in Delphi), and there is a round(double) and a round(currency). You get the same error on any non-x86 platform as well.

Is your conclusion that this is a feature, not a bug ?

Micha

Reply by email

Jonas Maebe
to Micha Nelissen
Micha Nelissen wrote 7 lines
> Because we do no support the extended type on win64, and the > priority for overload choosing between double and currency is the > same for variants (as in Delphi), and there is a round(double) and > a round(currency). You get the same error on any non-x86 platform > as well. Is your conclusion that this is a feature, not a bug ?

It's a fact you have to take into account.

Jonas

Reply by email