[fpc-devel] Re: Testing for..in feature

Michael Van Canneyt michael at freepascal.org
Thu Nov 5 09:01:07 CET 2009



On Thu, 5 Nov 2009, Paul Ishenin wrote:

> Florian Klaempfl wrote:
>> You can use the rtti generated for those enums.
>
> Actually I can't :)
>
> uses
>  typinfo;
> type T = (a1, b1=5);
> var
>  ch: T;
>  Info: PTypeInfo;
> begin
>  Info := TypeInfo(T);
>
> compiler: project1.lpr(10,11) Error: No type info available for this type
>
> So what is the best solution for now:
>
> 1) check if enum has jumps and give an error

This is the best solution. There are many other things that don't work with enums
that have jumps; This is just an additional one.

Enums with jumps are just a kludge to mimic C enums, which are in reality just a bunch
of constants .

Michael.



More information about the fpc-devel mailing list