<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 13.04.2018 23:16, Sven Barth via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFMUeB-QQK+YTHLbH6peXf5EXKYfp3ZS=reCxe2URmyhh0Hy+A@mail.gmail.com">
<div dir="auto">I wasn't talking about the boundaries. I meant
undefined values inside the enum. If we want such a cast
operator to work with such enums as well it should check for
invalid values inside the enum, too. Otherwise the operator
isn't worth it and should be forbidden for such enums.</div>
</blockquote>
<br>
How can I know what you mean with <i>"</i><i>What about enums with
holes?</i><i>"</i> ? :)<br>
<br>
Nevertheless, as I already said in the reply to Martok, there are no
undefined values inside an enum with assigned values. The values
only don't have an alias. See the Delphi docs:<br>
<br>
<a class="moz-txt-link-freetext"
href="http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Simple_Types_%28Delphi%29#Enumerated_Types_with_Explicitly_Assigned_Ordinality">http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Simple_Types_(Delphi)#Enumerated_Types_with_Explicitly_Assigned_Ordinality</a><br>
<br>
<i>type Size = (Small = 5, Medium = 10, Large = Small + Medium);</i><br>
<br>
<i>An enumerated type is, in effect, a subrange whose lowest and
highest values correspond to the lowest and highest ordinalities
of the constants in the declaration. In the previous example, the
Size type has 11 possible values whose ordinalities range from 5
to 15. (Hence the type array[Size] of Char represents an array of
11 characters.) Only three of these values have names, but the
others are accessible through typecasts and through routines such
as Pred, Succ, Inc, and Dec.<br>
<br>
</i>IMO the docs are very clear about it. BTW. the Delphi 7 docs
have the same information:
<a class="moz-txt-link-freetext" href="http://docs.embarcadero.com/products/rad_studio/cbuilder6/EN/CB6_ObjPascalLangGuide_EN.pdf">http://docs.embarcadero.com/products/rad_studio/cbuilder6/EN/CB6_ObjPascalLangGuide_EN.pdf</a>
see page 5-7 and 5-8<br>
<br>
Ondrej<br>
<i></i><i> </i>
</body>
</html>