Click here to Skip to main content
15,908,020 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalhardware enumeration Pin
brilliant10124-Mar-05 19:54
brilliant10124-Mar-05 19:54 
GeneralRe: hardware enumeration Pin
brilliant10124-Mar-05 20:00
brilliant10124-Mar-05 20:00 
GeneralRe: hardware enumeration Pin
toxcct24-Mar-05 22:07
toxcct24-Mar-05 22:07 
GeneralRe: hardware enumeration Pin
David Crow25-Mar-05 2:53
David Crow25-Mar-05 2:53 
Generalhigh performance graphic libaray! Pin
simonchen.net24-Mar-05 18:12
simonchen.net24-Mar-05 18:12 
Questionwhat does enum type do? whats the difference? Pin
ligerDave24-Mar-05 17:27
ligerDave24-Mar-05 17:27 
AnswerRe: what does enum type do? whats the difference? Pin
Ed K24-Mar-05 17:55
Ed K24-Mar-05 17:55 
AnswerRe: what does enum type do? whats the difference? Pin
Roger Wright26-Mar-05 21:30
professionalRoger Wright26-Mar-05 21:30 
I'm not much of a C++ programmer myself, but I see enum variables as integers with a restricted set of values, like the old set type in Pascal. The list of possible values for an enum are mapped to integers which can be assigned explicitly or automatically. The declaration

enum Colors (Red, Blue, Yellow);

assigns integer tokens to represent the words "Red," "Blue," and "Yellow" but in the program you don't have to worry about what value was assigned; you only have to worry about trying to assign a variable of the type Colors a value other than one of those in the list.

If you're worried about it you can also assign the integer values -

enum DaysOfTheWeek (Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6, Sun=7);

If you later declare a variable

DaysOfTheWeek Today;

You can assign it the value of 3 or Wed and still get the same result:

Today=3;
if (Today == Wed) doSomething();

will execute doSomething().

Enums greatly improve program readability, and help to reduce maintenance costs. In a way they are like arrays, or more accurately vectors as they have only one dimension. But arrays and vectors are not limited in the values they contain (other than the limitations of their types). Enums are, by definition, restricted to certain values that you define.

"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
GeneralMultiple Selection In ListBox MFC Pin
emilie560224-Mar-05 16:46
emilie560224-Mar-05 16:46 
GeneralRe: Multiple Selection In ListBox MFC Pin
David Crow25-Mar-05 3:42
David Crow25-Mar-05 3:42 
GeneralString manipulation.. Pin
RobJones24-Mar-05 15:12
RobJones24-Mar-05 15:12 
GeneralRe: String manipulation.. Pin
Michael Dunn24-Mar-05 15:40
sitebuilderMichael Dunn24-Mar-05 15:40 
GeneralRe: String manipulation.. Pin
RobJones24-Mar-05 16:10
RobJones24-Mar-05 16:10 
QuestionHow to load a mht file into IWebBrowser2 from stream ? Pin
Tcpip200524-Mar-05 14:54
Tcpip200524-Mar-05 14:54 
Questioncrash with dump? Pin
zecodela24-Mar-05 14:01
zecodela24-Mar-05 14:01 
AnswerRe: crash with dump? Pin
Roger Wright26-Mar-05 21:35
professionalRoger Wright26-Mar-05 21:35 
GeneralRe: crash with dump? Pin
zecodela27-Mar-05 15:01
zecodela27-Mar-05 15:01 
GeneralPermutations Pin
Pebbles124-Mar-05 12:23
Pebbles124-Mar-05 12:23 
GeneralRe: Permutations Pin
Shao Voon Wong24-Mar-05 13:05
mvaShao Voon Wong24-Mar-05 13:05 
GeneralRe: Permutations Pin
Pebbles124-Mar-05 14:10
Pebbles124-Mar-05 14:10 
GeneralRe: Permutations Pin
toxcct24-Mar-05 20:50
toxcct24-Mar-05 20:50 
GeneralSimulate CTRL+ALT+DEL Pin
zoroto24-Mar-05 10:43
zoroto24-Mar-05 10:43 
GeneralRe: Simulate CTRL+ALT+DEL Pin
Kelly Herald24-Mar-05 11:01
Kelly Herald24-Mar-05 11:01 
GeneralRe: Simulate CTRL+ALT+DEL Pin
geo_m25-Mar-05 2:32
geo_m25-Mar-05 2:32 
GeneralRe: Simulate CTRL+ALT+DEL Pin
David Crow25-Mar-05 2:53
David Crow25-Mar-05 2:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.