<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 05.07.2019 22:44, J. Gareth Moreton
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:e65c3657-0407-5796-3d64-39ffa33e68d0@moreton-family.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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.</p>
</blockquote>
<p>IMO handling holes in enumerations is just a pure waste of time
and energy. Delphi documents them as valid and the FPC compiler
handles them as valid as well. IMO it is just an unnecessary extra
added limitation to disable IS/AS on them. Furthermore they are
used mainly for very specific needs, so are very marginal. The
effort to make this work just doesn't pay off.<br>
</p>
<p>Btw. you get a "project1.lpr(7,10) Warning: Case statement does
not handle all possible cases" in the program below anyway:<br>
</p>
<p>program Project1;<br>
type<br>
THoleEnum = (two=2, four=4);<br>
var<br>
E: THoleEnum;<br>
begin<br>
case E of<br>
two: ;<br>
four: ;<br>
end;<br>
end.</p>
<p>What will you do now, disable case-of for enumerations with holes
because the compiler cannot handle the holes correctly in the
strict FPC POV way?<br>
</p>
<p>Ondrej<br>
</p>
</body>
</html>