|
-
Oct 24th, 2001, 01:25 PM
#1
Enumerations
Can I change the data type of an enumeration?
I think enums are 32-bit by default, what if I want a 64-bit?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 24th, 2001, 02:01 PM
#2
Maybe they are when using a 64-bit processor...
They are 32-bit on this machine... which of course is 32-bit.
-
Oct 24th, 2001, 02:04 PM
#3
This is legal in ansi C: (long on my machine is 64 bits, int is 32)
You can cast an enum - it's defined as an int datatype.
I assume you can do this by casting in VC++:
i = (int64) myenumVar;
legal ansi C ---
Code:
main(){
enum modes {
mode1 = 1,
mode2 = 2
}
long i;
i = (long) mode1;
}
Why -- are you getting errors?
-
Oct 24th, 2001, 02:14 PM
#4
But that is just storing a "32-bit" value into a 64-bit data type.
what about this...
Code:
enum CHECKITOUT
{
ITEM1 = 2200000000
}
2200000000 is larger than a 32-bit datatype... So we would end up with some negative number here.
-
Oct 24th, 2001, 02:25 PM
#5
Member
An enumeration data type provides mnemonic identifiers for a set of integer values. Borland C++ stores enumerators in a single byte if you uncheck Treat Enums As Ints (O|C|Code Generation) or use the -b flag.
So maybe a compiler option?
-
Oct 25th, 2001, 08:45 AM
#6
MSDN doesn't say anything about it. What if I want a set of more than 32 flags (each one is 1 bit)? I want them as enum so I can put them into a class (unlike #define). Do I have to split those flags into two enums?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|