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

Ondrej Pokorny lazarus at kluug.net
Sun Apr 22 06:53:40 CEST 2018


On 21.04.2018 13:38, Martok wrote:
> Am 20.04.2018 um 21:35 schrieb Ondrej Pokorny:
>> Therefore I enabled the IS/AS operators on enums with holes only in Delphi mode
>> and disabled them in all other modes.
> Please do not do this. The other modes are the only ones that really need it, in
> Delphi mode, nothing should break on invalid enum values anyway (if it does, it
> is a compiler error).

This was just an extension I added because Sven asked for it earlier in 
this thread: 
http://lists.freepascal.org/pipermail/fpc-devel/2018-April/038758.html

You know that I agree with you on the enum topic (and the case 
optimization as well). With the new IS/AS I am just trying to get a 
convenient and built-in way to check for valid enum values - with 
"valid" I mean "valid" as the FPC team understands it (since they do the 
rules).

How the IS/AS operator will be implemented and if it will be implemented 
at all and not rejected is upon the FPC developers that will finally 
decide about merging it to trunk. I am quite sure they will modify the 
patch before applying anyway to comply with their philosophy.

My goal is to get the best from it. If disallowing of IS/AS for enums 
with holes in FPC modes is a requirement for applying the patch, I am OK 
with this sacrifice.

Ondrej



More information about the fpc-devel mailing list