![]() |
What is a boolean data type?
This is getting weird. I have to keep moving between visual c and gnu
c++ compilers and now have come across a problem that seems to relate to the boolean datatype. I have a method that is defined as boolean isOkay(string var) { ... some code ... return(true); } But this seems to not be working properly. So I did a quick investigation of the boolean adta type and can find nothing for it. I can find the following bool = original C Boolean = C++ BOOLEAN = not sure So what is boolean and why does it now work the same as bool, or Boolean or BOOLEAN? TIA, Pep. |
Re: What is a boolean data type?
Pep wrote:
> This is getting weird. I have to keep moving between visual c and gnu > c++ compilers and now have come across a problem that seems to relate > to the boolean datatype. > > I have a method that is defined as > > boolean isOkay(string var) > { > ... some code ... > > return(true); > } > > But this seems to not be working properly. > > So I did a quick investigation of the boolean adta type and can find > nothing for it. I can find the following > > bool = original C > Boolean = C++ > BOOLEAN = not sure I would disagree with all three. AFAIK C has no bool type, the C++ type is 'bool' and Microsoft's type is 'BOOL'. > So what is boolean and why does it now work the same as bool, or > Boolean or BOOLEAN? Stick to bool, that's the standard C++ type. HTH, - J. |
Re: What is a boolean data type?
bool
This keyword is a built-in types in the standard c++, (should be true or false) BOOLEAN Boolean variable (should be TRUE or FALSE). This type is declared in WinNT.h as follows: typedef BYTE BOOLEAN; |
Re: What is a boolean data type?
linuke@gmail.com wrote: > bool > This keyword is a built-in types in the standard c++, (should be true > or false) > > BOOLEAN > Boolean variable (should be TRUE or FALSE). > This type is declared in WinNT.h as follows: > typedef BYTE BOOLEAN; Thanks to everyone, as suspected I'll stick to the c++ type. Incidentally it turns out the boolean type is working correctly, the problem with the code is further down the source deck, go figure :) Cheers, Pep. |
Re: What is a boolean data type?
linuke@gmail.com wrote:
> bool > This keyword is a built-in types in the standard c++, (should be true > or false) > > BOOLEAN > Boolean variable (should be TRUE or FALSE). > This type is declared in WinNT.h as follows: > typedef BYTE BOOLEAN; > Which in fact, is not a boolean. It's a char which has the old C behavior of zero for false, anything else for true. |
Re: What is a boolean data type?
Pep:
> boolean isOkay(string var) If I'm not mistaken, the type in question is called "boolean" in Java, and "bool" in C++. There's no such things as "boolean", "BOOLEAN" or "BOOL" in Standard C++. -- Frederick Gotham |
Re: What is a boolean data type?
Jacek Dziedzic wrote:
> Pep wrote: >> This is getting weird. I have to keep moving between visual c and gnu >> c++ compilers and now have come across a problem that seems to relate >> to the boolean datatype. >> >> I have a method that is defined as >> >> boolean isOkay(string var) >> { >> ... some code ... >> >> return(true); >> } >> >> But this seems to not be working properly. >> >> So I did a quick investigation of the boolean adta type and can find >> nothing for it. I can find the following >> >> bool = original C >> Boolean = C++ >> BOOLEAN = not sure > > I would disagree with all three. AFAIK C has no bool type, <OT> FYI: As of C99, C does have a built in boolean type, it's called "_Bool", or after you include <stdbool.h>, "bool" (i.e. same name as in C++). </OT> -- Clark S. Cox III clarkcox3@gmail.com |
Re: What is a boolean data type?
Clark S. Cox III wrote:
> Jacek Dziedzic wrote: >> Pep wrote: >>> This is getting weird. I have to keep moving between visual c and gnu >>> c++ compilers and now have come across a problem that seems to relate >>> to the boolean datatype. >>> >>> I have a method that is defined as >>> >>> boolean isOkay(string var) >>> { >>> ... some code ... >>> >>> return(true); >>> } >>> >>> But this seems to not be working properly. >>> >>> So I did a quick investigation of the boolean adta type and can find >>> nothing for it. I can find the following >>> >>> bool = original C >>> Boolean = C++ >>> BOOLEAN = not sure >> I would disagree with all three. AFAIK C has no bool type, > > <OT> > FYI: As of C99, C does have a built in boolean type, it's called > "_Bool", or after you include <stdbool.h>, "bool" (i.e. same name as in > C++). > </OT> Thanks, I forgot C keeps evolving. :) - J. |
| All times are GMT. The time now is 07:54 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.