[fpc-pascal] FPC can't determine overloaded function to call
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Thu Apr 28 15:33:36 CEST 2016
On 2016-04-28 14:22, Peter wrote:
> I suspect '(W div 2) gives int64.
Interesting thought. But a Integer div Integer cannot give a result
larger than a Integer type, so why is the compiler upscaling the result
it to a Int64?? If that is really what the compiler is doing, then
something is going way wrong, or I simply don't understand the logic.
I looked through the help, and the Objects.pp unit actually has a
LongDiv() method which does a DIV between two Integer types and returns
a Integer [as one would expect the result to be]. But looking at its
implementation I see it required a Integer cast too. Very strang
compiler behaviour. :-/
FUNCTION LongDiv (X: LongInt; Y: Integer): Integer;
BEGIN
LongDiv := Integer(X DIV Y);
END;
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal
mailing list