[fpc-pascal] Generic type conflicts
pascaldragon at googlemail.com
Thu Nov 7 18:25:12 CET 2019
Michael Van Canneyt <michael at freepascal.org> schrieb am Do., 7. Nov. 2019,
> On Thu, 7 Nov 2019, Ben Grasset via fpc-pascal wrote:
> > On Thu, Nov 7, 2019 at 3:03 AM Sven Barth via fpc-pascal <
> > fpc-pascal at lists.freepascal.org> wrote:
> >> If there is no type checking, then it is *not* verified by the compiler.
> > Perhaps "no type checking" was not the write way to put it. A better way
> > describe it might be:
> > E.G. it could still do the full checking, as the only thing that really
> > matters is that it does not actively raise error messages only relevant
> > Integer under code blocks only entered for tkFloat.
> If I understood Sven's example correct, then the compiler does exactly this
Not quite. If the generic parameter T is a LongInt, then the branch for
tkFloat *must* also be valid for LongInts. Because the type checking is
done *before* the branch is discarded.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal