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

Martok listbox at martoks-place.de
Fri Jul 5 11:05:07 CEST 2019


Am 05.07.2019 um 10:47 schrieb Michael Van Canneyt:
> Note that the explanation is IMO fuzzy, not to say contradictory:
> 
> 'An enumerated type defines an ordered set of values by simply listing identifiers that denote these values'
> 
> is at odds with (under the heading 'Enumerated Types with Explicitly Assigned Ordinality'):
> 
> 'An enumerated type is, in effect, a subrange'

No contradiction here: the corresponding implied subrange goes from lowest to
highest assigned value, which is 0..n for dense enumerations and
low(consts)..high(consts) for Enumerated Types with Explicitly Assigned
Ordinality. There is nothing special about the holes, they just have no names.
This is also how the Delphi debugger displays them.


Again, I recommend reading the TP5 and TP7 books, which contained the
*rationale* for most of the type system. That got left out when they rewrote the
content for Delphi Help.


-- 
Regards,
Martok

Ceterum censeo b32079 esse sanandam.



More information about the fpc-devel mailing list