[fpc-devel] Abs(Variant) unexpected result
bartjunk64 at gmail.com
Sun Feb 25 17:11:27 CET 2018
On Sun, Feb 25, 2018 at 5:01 PM, Jonas Maebe <jonas at freepascal.org> wrote:
> As Michael said, overloads are selected at compile time. This is true for
> both FPC and Delphi. We even have over a 100 unit tests that we ran under
> Delphi to reverse engineer their selection priorities in case of variants:
> Abs(), however, gets a forced conversion to float in Delphi:
Hmm, did not find that one (I searched bugtracker before posting here).
Seems you are right:
Delphi Tokyo 10.2
X = -1
VarIsFloat : FALSE
X = 1
VarIsFloat : TRUE
So, would it be possible to have an overloaded Abs(V: Variant):
Variant; function in the variants unit?
To be clear. Personally I don't need it (at least not ATM), I'm just curious.
Thanks for explaining.
More information about the fpc-devel