<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 14px;" lang="x-unicode">On 02.07.2017 22:02, Florian
Klämpfl wrote:
<br>
<blockquote type="cite" style="color: #000000;">Am 02.07.2017 um
21:40 schrieb Martok:
<br>
<blockquote type="cite" style="color: #000000;">Honestly, I
still don't understand why we're even having this discussion.
<br>
</blockquote>
Because it is a fundamental question: if there is any defined
behavior possible if a variable
<br>
contains an invalid value. I consider a value outside of the
declared range as invalid, if it shall
<br>
be valid, change the declaration of the type.
<br>
</blockquote>
<br>
In this case, please fix the compiler so that it doesn't generate
invalid values by default:
<br>
<br>
program Project1;
<br>
<br>
{$mode objfpc}{$H+}
<br>
<br>
type
<br>
TMyEnum = (one = 1, two);
<br>
<br>
TMyClass = class
<br>
public
<br>
Enum: TMyEnum;
<br>
end;
<br>
<br>
var
<br>
O: TMyClass;
<br>
begin
<br>
O := TMyClass.Create;
<br>
case O.Enum of
<br>
one: WriteLn('1');
<br>
two: WriteLn('2');
<br>
else
<br>
WriteLn('something wrong :/');
<br>
end;
<br>
end.
<br>
<br>
Ondrej
<br>
</div>
</body>
</html>