Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

johnnyBravo

c++,Difference between BOOL and bool?

This topic is 5239 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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,

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!