Click here to Skip to main content
15,914,767 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCreateDispatch fails Pin
Jochen Tuemmers23-Jun-05 5:46
Jochen Tuemmers23-Jun-05 5:46 
QuestionCan the path to a file be determined from a print job? Pin
the_grip23-Jun-05 5:32
the_grip23-Jun-05 5:32 
AnswerRe: Can the path to a file be determined from a print job? Pin
Jose Lamas Rios23-Jun-05 15:41
Jose Lamas Rios23-Jun-05 15:41 
QuestionCouldn't bool be better in C++?? Pin
tom_dx23-Jun-05 5:23
tom_dx23-Jun-05 5:23 
AnswerRe: Couldn't bool be better in C++?? Pin
Maximilien23-Jun-05 5:37
Maximilien23-Jun-05 5:37 
AnswerRe: Couldn't bool be better in C++?? Pin
Chris Losinger23-Jun-05 5:39
professionalChris Losinger23-Jun-05 5:39 
AnswerRe: Couldn't bool be better in C++?? Pin
toxcct23-Jun-05 5:48
toxcct23-Jun-05 5:48 
AnswerRe: Couldn't bool be better in C++?? Pin
basementman23-Jun-05 6:41
basementman23-Jun-05 6:41 
Back in the old days of C when every byte of memory counted, we used to define a structure of bits so that it would be clearly referenced in code and only use a byte of memory. So, to declare six flags in a byte, you would define a struct like this:
typedef struct _tagBitFlags
{
  unsigned char Flag1 : 1;
  unsigned char Flag2 : 1;
  unsigned char Flag3 : 1;
  unsigned char Flag4 : 1;
  unsigned char Flag5 : 1;
  unsigned char Flag6 : 1;
  unsigned char unused : 2;
} BitFlags;


Then to access the flags, you could write something like this:

if (BitFlags.Flag1)
  printf("Flag1 is set");
else
  printf("Flag1 is cleared");


Note that the value you can set a flag to must be in the bit range that the structure member can hold. This means that if, as in the above example, Flag1 is declared as one bit, it can only hold the values 0 and 1, whereas unused is declared as two bits and can be assigned the values 0, 1, 2, or 3.

Hope this doesn't date me too badly....Unsure | :~

 onwards and upwards... 
GeneralRe: Couldn't bool be better in C++?? Pin
Blake Miller23-Jun-05 7:44
Blake Miller23-Jun-05 7:44 
GeneralRe: Couldn't bool be better in C++?? Pin
basementman23-Jun-05 7:49
basementman23-Jun-05 7:49 
AnswerRe: Couldn't bool be better in C++?? Pin
Bob Stanneveld23-Jun-05 7:24
Bob Stanneveld23-Jun-05 7:24 
GeneralBase class initialization problem Pin
pesho293223-Jun-05 5:09
pesho293223-Jun-05 5:09 
GeneralRe: Base class initialization problem Pin
Jose Lamas Rios23-Jun-05 5:34
Jose Lamas Rios23-Jun-05 5:34 
GeneralRe: Base class initialization problem Pin
pesho293223-Jun-05 21:29
pesho293223-Jun-05 21:29 
GeneralFile Properties Pin
Rage23-Jun-05 4:22
professionalRage23-Jun-05 4:22 
GeneralRe: File Properties Pin
David Crow23-Jun-05 4:36
David Crow23-Jun-05 4:36 
GeneralRe: File Properties Pin
Rage23-Jun-05 20:54
professionalRage23-Jun-05 20:54 
GeneralRe: File Properties Pin
David Crow24-Jun-05 2:33
David Crow24-Jun-05 2:33 
GeneralHELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Ana-bahy23-Jun-05 3:32
Ana-bahy23-Jun-05 3:32 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Cedric Moonen23-Jun-05 3:47
Cedric Moonen23-Jun-05 3:47 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 3:55
ana_bahy23-Jun-05 3:55 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 3:57
ana_bahy23-Jun-05 3:57 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
ana_bahy23-Jun-05 4:02
ana_bahy23-Jun-05 4:02 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Cedric Moonen23-Jun-05 4:05
Cedric Moonen23-Jun-05 4:05 
GeneralRe: HELP!! Got couple of hours to fix dat problem or...i am over..!! Pin
Cedric Moonen23-Jun-05 4:03
Cedric Moonen23-Jun-05 4:03 

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.