[fpc-devel]

Gerhard Scholz gs at g--s.de
Wed Jun 29 00:37:32 CEST 2005


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcallcandidates.get_information_in_htypechk.pas
Type: application/octet-stream
Size: 8930 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050629/28165c2b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_real_in_defutil.pas
Type: application/octet-stream
Size: 410 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050629/28165c2b/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paratreestr_in_htypechk.pas
Type: application/octet-stream
Size: 569 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050629/28165c2b/attachment-0002.obj>


More information about the fpc-devel mailing list