c++,Difference between BOOL and bool?

Started by
7 comments, last by johnnyBravo 19 years, 11 months ago
In c++ Hi, whats the difference betwenn BOOL and bool? Like when i try to make a method that returns BOOL return to bool i get warnings, it still works but is there some way of making BOOL properly equal bool. And whats the difference or reason for having both thanks,
Advertisement
BOOL is not a built-in type in c++ but bool is.
a BOOL is the same as an int, its typedef''d in WINDEF.H

~aussie

"one of these days im going to cut you into little pieces!" - Pink Floyd
[~aussie]
I''m pretty sure that both BOOL and bool are typedef''d int''s. I don''t think that C/C++ has a true boolean data type.
quote:
I don''t think that C/C++ has a true boolean data type


C doesn''t, C++ does.

You have to remember that you''re unique, just like everybody else.
If at first you don't succeed, redefine success.
A similar question to this one was asked a while ago here it is

http://www.gamedev.net/community/forums/topic.asp?topic_id=226070


[edited by - JohnyB on May 21, 2004 1:27:14 PM]
quote:Original post by python_regious
quote:I don''t think that C/C++ has a true boolean data type
C doesn''t, C++ does.
As of C99, C does.
quote:Original post by johnnyBravo
Like when i try to make a method that returns BOOL return to bool i get warnings, it still works but is there some way of making BOOL properly equal bool. And whats the difference or reason for having both

The reason why Microsoft platforms provide the BOOL #define or typedef (I suspect the former) is that it and its role in the Windows libraries predates the C++ standard and, as such, the standardised bool type; also that these Windows libraries are presumably expected to work with C, which does not have a native Boolean type like the C++ bool.

quote:Original post by Oluseyi
quote:Original post by python_regious
quote:I don't think that C/C++ has a true boolean data type
C doesn't, C++ does.
As of C99, C does.

Is it a native type or a typedef defined in a header somewhere? I confess I am quite uninformed when it comes to C99.

[edited by - Miserable on May 21, 2004 1:39:11 PM]
quote:Original post by Miserable
Is it a native type or a typedef defined in a header somewhere? I confess I am quite uninformed when it comes to C99.


Both - sort of. C99 makes _Bool a built-in type. _Bool pretty much has the same semantics in C99 that bool has in C++. Then in stdbool.h, there is a #define that sets bool to expand to _Bool, along with macros for true and false.

This topic is closed to new replies.

Advertisement