Click here to Skip to main content
15,886,963 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to best pull together data from multiple sources (hardware sensors) in Win32? Pin
Albert Holguin24-Jun-15 12:04
professionalAlbert Holguin24-Jun-15 12:04 
GeneralRe: How to best pull together data from multiple sources (hardware sensors) in Win32? Pin
MW-83121724-Jun-15 23:55
MW-83121724-Jun-15 23:55 
GeneralRe: How to best pull together data from multiple sources (hardware sensors) in Win32? Pin
Albert Holguin25-Jun-15 9:24
professionalAlbert Holguin25-Jun-15 9:24 
GeneralRe: How to best pull together data from multiple sources (hardware sensors) in Win32? Pin
MW-83121726-Jun-15 3:04
MW-83121726-Jun-15 3:04 
QuestionSDI Project Question Pin
Arrin23-Jun-15 9:00
Arrin23-Jun-15 9:00 
SuggestionRe: SDI Project Question Pin
David Crow23-Jun-15 9:50
David Crow23-Jun-15 9:50 
GeneralRe: SDI Project Question Pin
Arrin23-Jun-15 12:21
Arrin23-Jun-15 12:21 
QuestionUse #define or enum in switch() case(s) ? Pin
Vaclav_22-Jun-15 5:40
Vaclav_22-Jun-15 5:40 
Academic question.

<b>Which do you prefer</b> - using preprocessor directive #define to replace case state - example "case 0:" with #define NORTH 0 and code "case NORTH:" or use enum?

Here is a sample code using enum:



Enumerated variables have a natural partner in the switch statement, as in the following code example.

#include <stdio.h>

enum compass_direction
{
north,
east,
south,
west
};


enum compass_direction get_direction()
{
return south;
}

/* To shorten example, not using argp */
int main ()
{
enum compass_direction my_direction;
puts ("Which way are you going?");
my_direction = get_direction();

switch (my_direction)
{
case north:
puts("North? Say hello to the polar bears!");
break;

case south:
puts("South? Say hello to Tux the penguin!");
break;

case east:
puts("If you go far enough east, you'll be west!");
break;

case west:
puts("If you go far enough west, you'll be east!");
break;
}

return 0;
}
AnswerRe: Use #define or enum in switch() case(s) ? Pin
PIEBALDconsult22-Jun-15 5:51
mvePIEBALDconsult22-Jun-15 5:51 
AnswerRe: Use #define or enum in switch() case(s) ? Pin
Jochen Arndt22-Jun-15 6:51
professionalJochen Arndt22-Jun-15 6:51 
AnswerRe: Use #define or enum in switch() case(s) ? Pin
Albert Holguin22-Jun-15 9:49
professionalAlbert Holguin22-Jun-15 9:49 
AnswerRe: Use #define or enum in switch() case(s) ? Pin
Vaclav_22-Jun-15 15:42
Vaclav_22-Jun-15 15:42 
GeneralRe: Use #define or enum in switch() case(s) ? Pin
Frankie-C22-Jun-15 22:44
Frankie-C22-Jun-15 22:44 
GeneralRe: Use #define or enum in switch() case(s) ? Pin
Vaclav_23-Jun-15 4:44
Vaclav_23-Jun-15 4:44 
AnswerRe: Use #define or enum in switch() case(s) ? Pin
Albert Holguin24-Jun-15 12:12
professionalAlbert Holguin24-Jun-15 12:12 
GeneralRe: Use #define or enum in switch() case(s) ? Pin
Vaclav_26-Jun-15 5:25
Vaclav_26-Jun-15 5:25 
GeneralRe: Use #define or enum in switch() case(s) ? Pin
Albert Holguin26-Jun-15 10:16
professionalAlbert Holguin26-Jun-15 10:16 
GeneralJust released the latest version of my open source project... Pin
Corvusoft21-Jun-15 4:30
Corvusoft21-Jun-15 4:30 
GeneralRe: Just released the latest version of my open source project... Pin
CPallini21-Jun-15 21:37
mveCPallini21-Jun-15 21:37 
GeneralRe: Just released the latest version of my open source project... Pin
Corvusoft21-Jun-15 21:50
Corvusoft21-Jun-15 21:50 
GeneralRe: Just released the latest version of my open source project... Pin
CPallini22-Jun-15 2:04
mveCPallini22-Jun-15 2:04 
GeneralRe: Just released the latest version of my open source project... Pin
Corvusoft21-Jun-15 21:52
Corvusoft21-Jun-15 21:52 
QuestionUpdatePanningFeedback() moves entire application window Pin
bob1697220-Jun-15 3:05
bob1697220-Jun-15 3:05 
QuestionDoubt Pin
Member 1177902719-Jun-15 16:38
Member 1177902719-Jun-15 16:38 
AnswerRe: Doubt Pin
Richard MacCutchan19-Jun-15 21:13
mveRichard MacCutchan19-Jun-15 21:13 

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.