Subj : Re: enumerated variables - how to coerce them to anything else than an Int ? To : borland.public.cpp.borlandcpp From : John F\(dot\) Date : Mon Oct 10 2005 10:59 pm "R.Wieser" wrote: > John F(dot) wrote: > > Hello John, > > >> 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 :-/ Try including a value larger than maximum int. That helped with OW 1.3 to get it sized 32bits... [CODE] #include "stdio.h" #include "conio.h" enum { x = 1L, y = 12999993L }X; int main(void) { X=x; X=y; printf("sizeof(X)==%ld::sizeof(long)==%ld\n",sizeof(X),sizeof(long)); getch(); return 0; } [/CODE] You wrote: "" >I've got a structure (not designed by me) that consists outof a number of >longs. Several of it's members contain enumerated data, like { default, >yes, no }. "" OK so far. what are the values for def, y, n ? and why weren't they designed to be enums then? :-) "" >I would like to make sure that I normally cannot put anything else in the >structure-member than what's permitted for it, but have hit a snag : I do >not seem to be able to enumerate anything else than Int's (the compiler's >default). "" Are you allowed to change the structure??? How comes that? Do you still need to store arbitrary longs into these member-variables? Could you give a short snippet of the code you need to be done? regards John .