[fpc-devel] [Suggestion] Enumeration range-check intrinsic
J. Gareth Moreton
gareth at moreton-family.com
Fri Jul 5 14:02:15 CEST 2019
Hi Michael,
I'm glad we agree on the "is" operator. Personally I would like to
extend it so it accepts "if (I is TMyEnum) then" when I is also of type
TMyEnum, since it may be the case that you're reading I directly from a
stream, either individually or as part of a record, in which case
converting I from an Integer to TMyEnum is a little inconvenient. When
you get down to the compiled assembly language it shouldn't really
matter anyway.
For enumerations with holes, having "is" return False if a value is
within one of these holes would require more complex code, at least to
work out how to programmatically cover these holes with conditions and
not pollute the simpler version where all elements are contiguous.
Gareth aka. Kit
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the fpc-devel
mailing list