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

Ondrej Pokorny lazarus at kluug.net
Tue Jul 2 21:32:53 CEST 2019


On 02.07.2019 21:15, Michael Van Canneyt wrote:
> Don't forget to check the post of Ondrej.
>
> Personally, I think using 'as' to convert an integer to an enum with 
> range
> check is still the best approach. It does not require new intrinsics (far
> too many of those already) and does what it says. To simply check if an
> integer is a valid enum, I think 'is' would be equally suitable.

The latest patch in https://bugs.freepascal.org/view.php?id=33603 
supports bot AS and IS operators. Yes, the first patch was only about 
the AS-operator and the issue summary is about AS only as well. You know 
- nobody is perfect and I didn't realize the IS-operator was suitable 
there too in the very beginning. The mind&development progress can be 
read from the ML thread.

Ondrej



More information about the fpc-devel mailing list