[fpc-pascal] Generic type conflicts

Sven Barth pascaldragon at googlemail.com
Sun Nov 10 09:15:03 CET 2019


Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
So., 10. Nov. 2019, 02:11:

>
>
> > 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.
>

The token recorder does not support preprocessor conditions. Not to mention
that this mixes preprocessor and parser stuff. Generics are part of the
parser.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20191110/20fdd4f7/attachment.html>


More information about the fpc-pascal mailing list