Click here to Skip to main content
16,008,299 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: radio button states Pin
Ravi Bhavnani2-Jan-04 22:28
professionalRavi Bhavnani2-Jan-04 22:28 
GeneralRe: radio button states Pin
Selvam R2-Jan-04 22:55
professionalSelvam R2-Jan-04 22:55 
GeneralRe: radio button states Pin
Ravi Bhavnani3-Jan-04 6:05
professionalRavi Bhavnani3-Jan-04 6:05 
GeneralRe: radio button states Pin
Prakash Nadar3-Jan-04 0:10
Prakash Nadar3-Jan-04 0:10 
GeneralRe: radio button states Pin
asierra13-Jan-04 14:08
asierra13-Jan-04 14:08 
GeneralThe difference between TRUE and true Pin
shultas2-Jan-04 15:09
shultas2-Jan-04 15:09 
GeneralRe: The difference between TRUE and true Pin
Jörgen Sigvardsson2-Jan-04 15:22
Jörgen Sigvardsson2-Jan-04 15:22 
GeneralRe: The difference between TRUE and true Pin
Michael Dunn2-Jan-04 16:15
sitebuilderMichael Dunn2-Jan-04 16:15 
bool is a C++ built-in type with two possible values, true and false. Nothing else.
BOOL is something MS made up for use in Windows and MFC. They needed a boolean type that worked in C and C++, and since they did this before bool was added to C++, they couldn't just reuse bool. BOOL is defined as:
typedef int BOOL;
#define FALSE 0
#define TRUE 1
The trouble with those definitions is that the BOOL notion of "true" is not 1 but non-zero. A function that returns a BOOL may return 1 to mean "true", or some other nonzero number (I've seen it myself, can't recall the API names off-hand though).

Because of that, you should never test a BOOL variable/function against TRUE, just test as a boolean and the language rules will take care of the rest.

You should, in general, use bool for your own code, assuming it's C++. You can pass a bool to a function expecting a BOOL because the bool gets promoted automagically by the language rules to the integer 0 or 1, for false or true respectively, which satisfies the definition of BOOL.

--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
If my rhyme was a drug, I'd sell it by the gram.
GeneralRe: The difference between TRUE and true Pin
Hauptman(n)3-Jan-04 5:16
Hauptman(n)3-Jan-04 5:16 
GeneralRe: The difference between TRUE and true Pin
Michael Dunn3-Jan-04 6:48
sitebuilderMichael Dunn3-Jan-04 6:48 
GeneralRe: The difference between TRUE and true Pin
Hauptman(n)3-Jan-04 8:36
Hauptman(n)3-Jan-04 8:36 
GeneralRe: The difference between TRUE and true Pin
shultas2-Jan-04 21:31
shultas2-Jan-04 21:31 
QuestionHow to select a folder in VC .NET Pin
shultas2-Jan-04 13:32
shultas2-Jan-04 13:32 
AnswerRe: How to select a folder in VC .NET Pin
Gary R. Wheeler2-Jan-04 14:02
Gary R. Wheeler2-Jan-04 14:02 
GeneralRe: How to select a folder in VC .NET Pin
shultas2-Jan-04 14:22
shultas2-Jan-04 14:22 
AnswerRe: How to select a folder in VC .NET Pin
Michael Dunn2-Jan-04 16:20
sitebuilderMichael Dunn2-Jan-04 16:20 
GeneralDrawing in layers Pin
mirano2-Jan-04 12:48
mirano2-Jan-04 12:48 
GeneralRe: Drawing in layers Pin
Azghar Hussain3-Jan-04 0:52
professionalAzghar Hussain3-Jan-04 0:52 
GeneralRe: Drawing in layers Pin
mirano4-Jan-04 5:52
mirano4-Jan-04 5:52 
GeneralDrawing in layers Pin
mirano2-Jan-04 12:47
mirano2-Jan-04 12:47 
GeneralRe: Drawing in layers Pin
l a u r e n2-Jan-04 14:19
l a u r e n2-Jan-04 14:19 
GeneralSQL statement problem Pin
Zombie_Inc2-Jan-04 12:38
Zombie_Inc2-Jan-04 12:38 
GeneralRe: SQL statement problem Pin
l a u r e n2-Jan-04 14:22
l a u r e n2-Jan-04 14:22 
GeneralRe: SQL statement problem Pin
Zombie_Inc3-Jan-04 0:38
Zombie_Inc3-Jan-04 0:38 
GeneralRe: SQL statement problem Pin
Zombie_Inc3-Jan-04 2:02
Zombie_Inc3-Jan-04 2:02 

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.