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

Ondrej Pokorny lazarus at kluug.net
Fri Apr 13 12:52:24 CEST 2018

On 02.07.2017 18:55, Ondrej Pokorny wrote:
> On 02.07.2017 18:49, Jonas Maebe wrote:
>> 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.
> Very good :)
>>> 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.
> If I am not mistaken, the AS operator cannot be overloaded - so no 
> chance to break legacy code here.


1.) you agreed that a built-in checked conversion from integer to 
arbitrary enumeration type is wanted and
2.) the AS-operator cannot be overloaded and thus the only argument 
against enum support for AS is not valid

I introduced the AS operator for enumerators in 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180413/75daa98a/attachment.html>

More information about the fpc-devel mailing list