Problem with real parameters in overloaded procs:

When defining an operator P with a CURRENCY parameter, and overloading that
operator with a DOUBLE parameter, the compiler cannot decide which one to
take when it is called with an EXTENDED actual parameter. The same seems to
be true for overloaded procs/funcs.

I suggest the following change:
the sort order for searching the appropriate routine should be done as
follows:

1. exact match (as it is done now);

2. extending the precision upward;

3. shrinking the precision downward.

This search for a "similar" real parameter should only be done for
SINGLE/DOUBLE/EXTENDED; COMP and CURRENCY are too special.
(I know that formally COMP and CURRENCY are reals; but I consider them too
special for automatic conversions).

The neccessary code can be found in the appendices.

I'm sorry, I have my problems with SVN, I tried to download with "svn -co",
but in the middle somewhere (in the directory tests) it stopped (it didn't
really stop, the internet connection was busy, but no more files were
transmitted). After that "svn -cleanup" didn't even work, the only thing
that did work was to throw away the subdirectory and retry. But the retry
came to the same result, and after the 3rd time I gave up.

So the code comes in pieces in the appendix.

"" is the is_real function in defutils.pas

"" is the new  function in htypechk.pas

"" is the changed  function in htypechk.pas; the old function shows the
parameters in the debug info in reverse order

Would be nice if this could be incorporated in the compiler.

Gerhard

Attachment: tcallcandidates.get_information_in_htypechk.pas
Description: Binary data

Attachment: is_real_in_defutil.pas
Description: Binary data

Attachment: paratreestr_in_htypechk.pas
Description: Binary data

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

Reply via email to