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

Michael Van Canneyt michael at freepascal.org
Tue Jul 2 21:15:24 CEST 2019



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.

Michael.

On Tue, 2 Jul 2019, J. Gareth Moreton wrote:

> Aah, thank you.
>
> On 02/07/2019 19:56, Michael Van Canneyt wrote:
>> 
>> 
>> On Tue, 2 Jul 2019, J. Gareth Moreton wrote:
>> 
>>> I don't recall a conversation where such an intrinsic is seen as 
>>> desirable, but if such a construct is desirable, then that's a good thing 
>>> since it will help patch up this problem.
>>> 
>>> As for the Delphi problem, it's second-hand information I heard from a 
>>> friend who uses Delphi at work and something about not handling 
>>> out-of-range enumerations was a deal-breaker from not using FPC.  I may 
>>> have some details wrong though.  But all that side, would development of 
>>> an intrinsic be an acceptable solution, and what name are we going for? 
>>> (One has to be careful we don't break existing code if possible)
>> 
>> 
>> See this thread:
>> 
>> https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg35100.html
>> 
>> Michael.
>> 
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>


More information about the fpc-devel mailing list