[fpc-devel] Dangerous optimization in CASE..OF

Jonas Maebe jonas at freepascal.org
Sun Jul 2 18:49:00 CEST 2017


On 02/07/17 18:43, Ondrej Pokorny wrote:
> Thanks, so there is no enumeration range checking from the compiler at 
> all :/

Yes, there is range checking for enums. No, there is no built-in checked 
conversion from integer to arbitrary enumeration types. That's why I 
suggested in the bug report that started this thread to file a feature 
request for such a conversion.

> Are there any disadvantages of the enum-AS operator that prevents its 
> introduction?

Someone else could already have code that overloads the AS-operator in 
this way, and such a change would break this (you cannot overload 
operators with a built-in meaning). I would be in favour of a new intrinsic.


Jonas



More information about the fpc-devel mailing list