What is the range that is valid for an enum (if enums are given ord values with "=")?
With 3.3.1
type TFoo =(a=0, b=$Ffffffff);
project1.lpr(3,29) Error: Enumeration symbols can only have values in
the range of -2^31 to 2^31-1So the compiler clearly thinks it is a signed integer (longint).
The documentation is not specific about it.
https://www.freepascal.org/docs-html/prog/progsu157.html
It doesn't exactly say what values the enum-val can have. It just specifies how many there can be.
0..255 means apparently an enum can have between 0 and 255 values.
It does not explicitly say that those values are the values between 0 and 255.
It specifies the storage requirements by using unsigned examples (byte/word).
Again, not explicitly saying that the stored value must have an unsigned ordinal value.
But, some suggestive element in it....
-----------------
Further 3.3.1
program Project1;
{$R-}
type TFoo =(a, b);
begin
writeln(ord(TFoo(1)));
writeln(ord(TFoo($ffffffff)));writes
1
-1
--------------
In that light my earlier mail "packed enum too small?" below...
Should that be reported as bug?
