What is a boolean data type?

P

Pep

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.
 
J

Jacek Dziedzic

Pep said:
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.
 
L

linuke

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;
 
P

Pep

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.
 
R

Ron Natalie

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.
 
F

Frederick Gotham

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++.
 
C

Clark S. Cox III

Jacek said:
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>
 
J

Jacek Dziedzic

Clark said:
<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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top