4c2 Subj : Re: enumerated variables - how to coerce them to anything else than an Int ? To : borland.public.cpp.borlandcpp From : Ed Mulroy Date : Mon Oct 10 2005 04:49 pm In Win32 an int IS a long. They are both 4 byte signed values. The C++ Language spec states that the conversion between an int and an enum is intrinsic so, be it an int or a long, assignment of anything, even if it is not one of the enum values is possible. The way I would try to limit what can be put into it is to define a class and overload the basic operations, checking for valid enum values and doing something for invalid ones. Then I would use that instead of the enum. You appear to be using an existing class. You might design a class which inherits from that existing one and which makes your LongEnum interface visible instead of the enum one. You will then be able to do whatever you want with it. .. Ed > R.Wieser wrote in message > news:434abf41@newsgroups.borland.com... > >> although some compilers allow long values to be stored >> as enums like [snip] > > Thanks for the suggestion. Alas, although it does not > generate an error, the resulting variable is still an Int :-/ . 0