[omniORB] enums
Gary D. Duzan
gdd0@gte.com
Thu, 30 Apr 1998 09:11:48 -0400
In Message <3548306B.C5B9FCF3@access.bel.alcatel.be> ,
"Dominic Chorafakis XE41 ext. 9049" <chorafad@access.bel.alcatel.be> wrote:
=>Hi,
=>
=>I would like to define an enum in IDL and have the
=>initial value explicitly set:
=>
=>enum X
=>{
=> x1=10,
=> x2,
=> x3
=>};
=>
=>The IDL compiler does not like this, and I don't see
=>anything about this in the IDL specification.
=>
=>Am I using the wrong syntax or is this not allowed
=>in IDL ?
Correct. You can't assign particular values to enumerators since
particular language mappings may not support having values for them.
(E.g. A LISP or Scheme mapping may use symbols, which do not in and of
themselves have values.) All the spec requires is that if the language
mapping allows the enum values to be compared, then the order of the
enumerators is preserved. Nothing else. You'll have to have your
program do the mapping from the enumerators you list (x1,x2,x3) to the
values you want (10,11,12).
Gary Duzan
GTE Laboratories