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

Michael Van Canneyt michael at freepascal.org
Sat Apr 14 09:59:31 CEST 2018

On Sat, 14 Apr 2018, Ondrej Pokorny wrote:

> On 02.07.2017 18:49, Jonas Maebe wrote:
>> I would be in favour of a new intrinsic.
> I have to admit that for some usages I would prefer a compiler intrinsic 
> that returns False instead of raising an exception. Something like:
> function TryIntToEnum<T: type of enum>(const AValue: Integer; var 
> AEnumValue: T): Boolean;

Please, don't use this ridiculous generics syntax. 
If it is a compiler intrinsic, then

function TryIntToEnum(T: atype; const AValue: Integer; var AEnumValue: aType): Boolean;

will work, just like typeinfo() or sizeof() works.


More information about the fpc-devel mailing list