Click here to Skip to main content
15,921,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Making .lib files Pin
Roger Stewart2-Sep-03 4:01
professionalRoger Stewart2-Sep-03 4:01 
QuestionHow to Create the Auto Start NT Service? Pin
Hendy_So2-Sep-03 3:07
Hendy_So2-Sep-03 3:07 
AnswerRe: How to Create the Auto Start NT Service? Pin
Xiangyang Liu 刘向阳2-Sep-03 12:25
Xiangyang Liu 刘向阳2-Sep-03 12:25 
GeneralRe: How to Create the Auto Start NT Service? Pin
Hendy_So2-Sep-03 14:33
Hendy_So2-Sep-03 14:33 
GeneralMP3 and WAV conversion Pin
jason992-Sep-03 2:45
jason992-Sep-03 2:45 
GeneralTAPI Pin
Faizi2-Sep-03 2:38
Faizi2-Sep-03 2:38 
GeneralCDateTimeCtrl question Pin
Niko Tanghe2-Sep-03 2:22
Niko Tanghe2-Sep-03 2:22 
QuestionWhat's the point of BOOL? Pin
Abin2-Sep-03 2:03
Abin2-Sep-03 2:03 
I know this is a relatively irrelevant issue but it's been in my mind for long time: while in stardard C we use bool for the "true-or-false" value, in MFC we see BOOL instead, which is in fact a typedef of 32 bit int on win32 plateform(I think). Now my question is why.

Seeing that in contrast with bool, BOOL does:

1, Occupy more memory storage, four bytes instead of one, not that matters a lot, but after all one has always been smaller than four since the first day when the human being could count.

2, Have pseudo-ambiguous data type comparing to bool, I said "pseudo" because the ambiguity is not for the compiler, but for the programmers themselves. In common sense I would think void Func(BOOL bVal) and void Func(int nVal) are different functions but they are in fact the same, so doing such overloading would generate compiler error. However, void Func(bool bVal) and void Func(int nVal) are indeed different and can be overloaded each other. Which one makes more sense to us?

Perhaps BOOL was introduced due to the fact that C++ allows an integer value to be treated as a "true-or-false", so without BOOL, then if (65535 * 2) { ...; } would generate a "data truncate" warning since a one-byte bool could not hold value of "65535 * 2", thus they came up with such a new BOOL which is capable of holding larger values. Hehe, personally, I never exam a pointer using if (p) { ...; }, I always use if (p != NULL) { ...; } instead, which I think is a better practice.

Anyway, I just couldn't see the necessity of BOOL even though I've been using BOOL in MFC applications for years.
AnswerRe: What's the point of BOOL? Pin
Jonas Larsson2-Sep-03 2:26
Jonas Larsson2-Sep-03 2:26 
AnswerRe: What's the point of BOOL? Pin
jason992-Sep-03 2:29
jason992-Sep-03 2:29 
AnswerRe: What's the point of BOOL? Pin
Brad Sokol2-Sep-03 2:34
Brad Sokol2-Sep-03 2:34 
AnswerRe: What's the point of BOOL? Pin
John M. Drescher2-Sep-03 4:05
John M. Drescher2-Sep-03 4:05 
AnswerRe: What's the point of BOOL? Pin
John M. Drescher2-Sep-03 4:16
John M. Drescher2-Sep-03 4:16 
AnswerRe: What's the point of BOOL? Pin
Xiangyang Liu 刘向阳2-Sep-03 5:27
Xiangyang Liu 刘向阳2-Sep-03 5:27 
AnswerRe: What's the point of BOOL? Pin
Terry O'Nolley2-Sep-03 7:22
Terry O'Nolley2-Sep-03 7:22 
GeneralC++ Question. Pin
WREY2-Sep-03 0:59
WREY2-Sep-03 0:59 
GeneralRe: C++ Question. Pin
Neville Franks2-Sep-03 2:25
Neville Franks2-Sep-03 2:25 
GeneralRe: C++ Question. Pin
WREY2-Sep-03 8:47
WREY2-Sep-03 8:47 
GeneralRe: C++ Question. Pin
Alexandru Savescu2-Sep-03 3:19
Alexandru Savescu2-Sep-03 3:19 
GeneralRe: C++ Question. Pin
WREY2-Sep-03 9:01
WREY2-Sep-03 9:01 
GeneralRe: C++ Question. Pin
Xiangyang Liu 刘向阳2-Sep-03 12:46
Xiangyang Liu 刘向阳2-Sep-03 12:46 
GeneralThanks for the solution!! Pin
WREY2-Sep-03 14:03
WREY2-Sep-03 14:03 
GeneralX-button Pin
JensB1-Sep-03 23:08
JensB1-Sep-03 23:08 
GeneralRe: X-button Pin
Jason Henderson2-Sep-03 3:08
Jason Henderson2-Sep-03 3:08 
GeneralRe: X-button Pin
JensB2-Sep-03 3:18
JensB2-Sep-03 3:18 

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.