[fpc-devel] [Suggestion] Enumeration range-check intrinsic

Giuliano Colla giuliano.colla at fastwebnet.it
Mon Jul 8 12:39:41 CEST 2019


Il 07/07/2019 07:33, J. Gareth Moreton ha scritto:
> In the meantime, I'm working on making
> "as" and "is" work with ordinal types as
> well as enumerations, although currently
> some headaches occur if the right-hand
> side is larger than the CPU word size
> (e.g. Int64 on i386). I'll upload the
> patch to the issue once it's working
> properly.

Sorry for jumping in without having followed the full discussion, but I 
wonder if "as" and "is" are the best constructs to implement range 
checking. Wouldn't "in" be much more appropriate?

Sort of:

if value in enumvar then DoThat else IgnoreIt;

Giuliano

-- 
Do not do to others as you would have them do to you.They might have different tastes.



More information about the fpc-devel mailing list