Re: [fpc-pascal] Overloading Inc and Dec procedures?

2019-09-18 Thread LacaK
Hi *, seems, that overloading of Inc, Dec internal compiler procedures is not allowed. Is it by intention or can it be fixed (adding overload keyword to system function definitions?). Yes, this is by intention and no, it can't be fixed. Thank you! Can it be th

Re: [fpc-pascal] Overloading Inc and Dec procedures?

2019-09-18 Thread Sven Barth via fpc-pascal
LacaK schrieb am Mi., 18. Sep. 2019, 13:38: > Hi *, > > seems, that overloading of Inc, Dec internal compiler procedures is not > allowed. > Is it by intention or can it be fixed (adding overload keyword to system > function definitions?). > Yes, this is by intention and no, it can't be fixed.

[fpc-pascal] Overloading Inc and Dec procedures?

2019-09-18 Thread LacaK
Hi *, seems, that overloading of Inc, Dec internal compiler procedures is not allowed. Is it by intention or can it be fixed (adding overload keyword to system function definitions?). I would like to add support for:   procedure Inc(var a: integer; b: single); overload; inline;   begin     a

Re: [fpc-pascal] Generics: Error: Can't determine which overloaded function to call

2019-09-18 Thread LacaK
Work-around which produces good assembler without writting/reading intermediate variables: class function T2DPoint.Sqr(value: T): T; static; inline; begin   Result := value*value; end; function T2DPoint.Distance(P: T2DPoint): Single; inline; begin   Result := Sqrt(Sqr(x-P.x) + Sqr(y-P.y)); end;

[fpc-pascal] Generics: Error: Can't determine which overloaded function to call

2019-09-18 Thread LacaK
Hi *, I have generics record, where one method computes distance between 2 points: function T2DPoint.Distance(P: T2DPoint): Single; begin   Result := Sqrt(Sqr(x-P.x) + Sqr(y-P.y)); end; But this does not compile as there are many versions of Sqr() in the scope Sqr(longint), Sqr(QWord), Sqr(Ext