[fpc-pascal] Generic type conflicts
Ryan Joseph
genericptr at gmail.com
Sat Nov 9 20:22:13 CET 2019
> On Nov 7, 2019, at 12:28 PM, Ben Grasset via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> {$IF GetTypeKind(T) in [tkInteger, tkInt64, tkQWord]}
> Result := A div B
> {$ELSEIF GetTypeKind(T) = tkFloat}
> Result := A / B
> {$ELSE}
> Result := Default(T);
> {$ENDIF}
This is what I hinted in my post. Has anything like this been considered before? It seems necessary to me but it looks like Sven had some fancy work around using pointers. Either way the compile time directive would be faster and avoid the conditional statements.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list