Ada enumerations with duplicate values
I'm trying to have a device register as an enumeration. Reading from the
register has 2 values -> 0 means Done, 1 means Pending. Likewise, writing
into the register has 2 values -> 0 has no action and 1 does a reset. So,
I wrote the following code
type Soft_Reset is (Done, Pending, No_Action, Reset);
for Soft_Reset use
(Done => 0,
Pending => 1,
No_Action => 0,
Reset => 1);
But this throws an error
gcc-4.6 -c -g -gnatg -ggdb -I- -gnatA /home/sid/tmp/device.adb
device.ads:93:20: enumeration value for "No_Action" not ordered
gnatmake: "/home/sid/tmp/device.adb" compilation error
Is it possible for a enumeration to have duplicate values?
No comments:
Post a Comment