<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 12.05.2019 16:36, Jonas Maebe wrote:<br>
</div>
<blockquote type="cite"
cite="mid:f8123f5e-7c51-276e-39c1-111f09f04bda@freepascal.org">Thanks.
I have added these warnings to the compiler in r42047, and also
the static/dynamic errors for Standard resp. Extended ISO Pascal.</blockquote>
<p>Very nice.</p>
<p>One question about "C-style enumeration types"
<a class="moz-txt-link-freetext" href="https://www.freepascal.org/docs-html/ref/refse12.html#QQ2-26-31">https://www.freepascal.org/docs-html/ref/refse12.html#QQ2-26-31</a></p>
<p>Do the holes between undefined enum values belong to the
enumeration or not? Because:<br>
</p>
<p>1.) The FPC documentation states they do not. See
<a class="moz-txt-link-freetext" href="https://www.freepascal.org/docs-html/ref/refse12.html#QQ2-26-31">https://www.freepascal.org/docs-html/ref/refse12.html#QQ2-26-31</a><br>
<i>"The Pred and Succ functions cannot be used on this kind of
enumeration types. Trying to do this anyhow will result in a
compiler error."</i></p>
<p>2.) The Delphi documentation states they do. See
<a class="moz-txt-link-freetext" href="http://docwiki.embarcadero.com/RADStudio/Rio/en/Simple_Types_(Delphi)#Enumerated_Types_with_Explicitly_Assigned_Ordinality">http://docwiki.embarcadero.com/RADStudio/Rio/en/Simple_Types_(Delphi)#Enumerated_Types_with_Explicitly_Assigned_Ordinality</a><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."</i></p>
<p>3.) Your newly added warnings indicate they do. Because a warning
is emitted if all well-defined values are used in the case
statement:</p>
<p><tt>program Project1;</tt><tt><br>
</tt><tt>{$mode objfpc}</tt><tt><br>
</tt><tt>type</tt><tt><br>
</tt><tt> TMyEnum = (one = 2, two = 5);</tt><tt><br>
</tt><tt>var</tt><tt><br>
</tt><tt> A: TMyEnum;</tt><tt><br>
</tt><tt>begin</tt><tt><br>
</tt><tt> A := TMyEnum(3);</tt><tt><br>
</tt><tt> case A of // compiler warning: Case statement does not
handle all possible cases</tt><tt><br>
</tt><tt> one: Exit;</tt><tt><br>
</tt><tt> two: Exit;</tt><tt><br>
</tt><tt> end;</tt><tt><br>
</tt><tt> Writeln(A); // run-time error 107 - so maybe not a
possible case after all?</tt><tt><br>
</tt><tt> ReadLn;</tt><tt><br>
</tt><tt>end.</tt><br>
</p>
<p>---</p>
<p>This dissimilarities should get resolved.</p>
<p>Ondrej<br>
</p>
</body>
</html>