On 25/02/18 16:41, Bart wrote:
Delphi 10.2 Tokyo:

X = -1,5
VarIsFloat : TRUE
VarIsNumeric: TRUE
VarIsOrdinal: FALSE
After Abs()
X = 1,5
VarIsFloat : TRUE
VarIsNumeric: TRUE
VarIsOrdinal: FALSE

I asked to test with "X := -1" to see if Delphi always chooses the
float overload.

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: https://svn.freepascal.org/svn/fpc/trunk/tests/test/cg/variants/

Abs(), however, gets a forced conversion to float in Delphi: https://bugs.freepascal.org/view.php?id=20551


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to