John Love-Jensen wrote: > > Hi Michael, > > The type for the enum, as given, will be signed int. > > Now if you want the enum to be ambiguous, you can do something like this: > > enum { Uno = -1, Dos, Tres = 0x80000000 }; > > That will cause an ambiguous overload of the signed & unsigned assignment > operators, since the 0x80000000 will be taken to be an unsigned int as per > the standard C/C++ interpretation rules. (Assuming a 32-bit int > platform.) > > Is that the situation you are running into? > > You can "fix" it by doing: > > enum { Uno = -1, Dos, Tres = int(0x80000000) }; > > --Eljay > > Wow, really? I didn't realize that was possible. I'll have to look into that, but in this case, there is also an operator for unsigned int assignment, so if it shoud resolve to that operator even in this case. I think before I had a 'long' in the int types I was using, so that might've made a difference. I subsequently removed it though. I'm not exactly sure how to guarantee a 32bit / 64bit value across 32/64bit platforms with gcc. GCC seems to resolve a 0 as a long int rather than just int. I could try myself naturally, but I don't suppose its possible to cast enum values to say a char or short type? Would a pointer type or something larger than 32bits be accomodated too? -- View this message in context: http://www.nabble.com/Does-GCC-assign-any-type-to-enums-that-can-be-specified-in-an-assignment-operator--tf3967638.html#a11294773 Sent from the gcc - Help mailing list archive at Nabble.com.