[fpc-devel] Re: enumerators

Marco van de Voort marcov at stack.nl
Sun Nov 14 23:22:57 CET 2010


In our previous episode, Hans-Peter Diettrich said:
> 
> > A more grave reason though is that Delphi does not have low() and high() on
> > sets and a request to add it by me in 2006 was closed with their equivalent
> > of "won't fix".
> 
> I wonder how FPC defines low() and high() for sets.

See the source.

> The static bounds 
> can be obtained from the underlying enumerated or subrange type, even in 
> Delphi. 

If defined separately. 

> So it would only make a difference, when FPC sets would track 
> the actual (dynamic) first and last element in an set, with special 
> handling for empty sets where both low() and high() cannot return valid 
> values.

No, it just handles the values from the basetype (range or enum), they are
still compiletime expressions.  The main use is that this means that you
don't have to recompile a library if sb was foolish enough to define a set
of an anonymous type.



More information about the fpc-devel mailing list