<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>In the meantime, I've extended your AS/IS patch <a
moz-do-not-send="true"
href="https://bugs.freepascal.org/view.php?id=33603">over here</a>
to create efficient code for x86 platforms, although currently it
only does a range check and won't correctly handle enumerations
with holes. If non-contiguous enumerations are going to be
allowed, we'll need to design an algorithm that can cover these
holes with the smallest number of Boolean conditions.<br>
</p>
<p>Gareth aka. Kit<br>
</p>
<div class="moz-cite-prefix">On 05/07/2019 21:13, Ondrej Pokorny
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:7a85cd7c-cec5-c8df-4cb3-df0abf94eff0@kluug.net">On
05.07.2019 16:51, Pierre Muller wrote:
<br>
<blockquote type="cite">This means that using pred() or succ()
intrinsics on enumerated types with
<br>
holes will generate a Compile Time Error.
<br>
<br>
To be consistent, I would propose that we also generate
<br>
a Compile Time Error if 'is' or 'as' keyword is used on such a
type,
<br>
unless there is a code that really check that the value is not
in
<br>
one of the holes ...
<br>
</blockquote>
<br>
I have to strongly disagree here. We need the IS/AS operators to
prevent undefined behavior. And if undefined behavior is only
outside the low/high bounds of the enumeration values and not
within the holes - then the IS/AS that checks only the bounds is
very consequent indeed. It's also consequent with the case-of
statement for an enum with holes. (See the thread I linked
before.)
<br>
<br>
Ondrej
<br>
<br>
_______________________________________________
<br>
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
<br>
<br>
<br>
</blockquote>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>