... Agreed. Still I think it should be possible to cast the value one time in the enum and not every time I use the enum. How about > value1 = integer(&h01) > value2 = integer(17)
IMHO, the current definition is just fine. If the enum is for use within your program only (e.g., to track a state table), you shouldn't need to cast at all. If the enum is for defining constants for use with an external protocol (e.g., protocol flags), it may make sense to keep them as constants. If the enum is mainly for use within your program, with an occasional transfer to/from an external item, use a cast. I just don't see any common cases where the odd cast should be a big problem. (That doesn't mean that there aren't some rare pathological cases, but they don't make good policy.) I used enums for many years in C programming - where they had to be cast to go to/from integers, if you wanted to do it properly[*] - and never had any problem with having to cast. Craig [*] Just because C lets you shut off/ignore compiler warnings and get away with something, doesn't mean that it's a good idea to. I normally ran with all warnings/diagnostics enabled and fixed the code. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
