bool and BOOL
-
hai, what is the difference between bool and BOOL? reply me..
Born to win...!
-
hai, what is the difference between bool and BOOL? reply me..
Born to win...!
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
hai, what is the difference between bool and BOOL? reply me..
Born to win...!
:-D
bool
is aC++
keyword,BOOL
a Microsoft alias forint
:typedef int BOOL;
Any variable declared
bool
can assume only the following two values:true
orfalse
, moreoverC++
conditional expressions evaluates to abool
result (true
orfalse
). On the other hand, aBOOL
variable is a fully qualifiedint
and hence can assume any numeric value anint
can (MSDN suggest: it should be eitherTRUE
orFALSE
). :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
hai, what is the difference between bool and BOOL? reply me..
Born to win...!
if you're coding in C,
bool
just don't exist (I prefer mention it, even it's obvious). in C++,bool
is a native type. it weights 1 byte and takes the values0_b_0000000**1**
(true
) or0_b_0000000**0**
(false
). you can assign an integer to abool
. if it is different from0
, it equals the value "true
", and will be automatically converted into0_b_0000000**1**
anyway.BOOL
is different. it is anenum
type inherited from the old C days. it's definition is like this :enum BOOL {
FALSE = 0,
TRUE
};An
enum
is actually anint
, which mean it weights 4 bytes (on a 32 bits system). apparently, Microsoft implements it in a different manner, so you have to be much more careful with it. for instance ://if defined like this :
typedef int BOOL;//this can be a mistake :
BOOL b = 4;
if (b == true) {
//never enters here
// because 4 != 1
}[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
modified on Tuesday, May 20, 2008 9:50 AM
-
:-D
bool
is aC++
keyword,BOOL
a Microsoft alias forint
:typedef int BOOL;
Any variable declared
bool
can assume only the following two values:true
orfalse
, moreoverC++
conditional expressions evaluates to abool
result (true
orfalse
). On the other hand, aBOOL
variable is a fully qualifiedint
and hence can assume any numeric value anint
can (MSDN suggest: it should be eitherTRUE
orFALSE
). :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeCPallini wrote:
typedef int BOOL
not really maybe :cool:
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
if you're coding in C,
bool
just don't exist (I prefer mention it, even it's obvious). in C++,bool
is a native type. it weights 1 byte and takes the values0_b_0000000**1**
(true
) or0_b_0000000**0**
(false
). you can assign an integer to abool
. if it is different from0
, it equals the value "true
", and will be automatically converted into0_b_0000000**1**
anyway.BOOL
is different. it is anenum
type inherited from the old C days. it's definition is like this :enum BOOL {
FALSE = 0,
TRUE
};An
enum
is actually anint
, which mean it weights 4 bytes (on a 32 bits system). apparently, Microsoft implements it in a different manner, so you have to be much more careful with it. for instance ://if defined like this :
typedef int BOOL;//this can be a mistake :
BOOL b = 4;
if (b == true) {
//never enters here
// because 4 != 1
}[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
modified on Tuesday, May 20, 2008 9:50 AM
toxcct wrote:
BOOL is different. it is an enum type inherited from the old C days. it's definition is like this : enum BOOL { FALSE = 0, TRUE };
Where did you get this information from? Under Windows,
BOOL
is defined as an integer inWindef.h
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
CPallini wrote:
typedef int BOOL
not really maybe :cool:
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
toxcct wrote:
not really
You've gotta be kidding me. CPallini is correct.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
CPallini wrote:
typedef int BOOL
not really maybe :cool:
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
Maybe both my local help and my
windef.h
file are wrong?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
toxcct wrote:
BOOL is different. it is an enum type inherited from the old C days. it's definition is like this : enum BOOL { FALSE = 0, TRUE };
Where did you get this information from? Under Windows,
BOOL
is defined as an integer inWindef.h
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
humm, it was in the C days... but anyway, an
enum
is anint
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
if you're coding in C,
bool
just don't exist (I prefer mention it, even it's obvious). in C++,bool
is a native type. it weights 1 byte and takes the values0_b_0000000**1**
(true
) or0_b_0000000**0**
(false
). you can assign an integer to abool
. if it is different from0
, it equals the value "true
", and will be automatically converted into0_b_0000000**1**
anyway.BOOL
is different. it is anenum
type inherited from the old C days. it's definition is like this :enum BOOL {
FALSE = 0,
TRUE
};An
enum
is actually anint
, which mean it weights 4 bytes (on a 32 bits system). apparently, Microsoft implements it in a different manner, so you have to be much more careful with it. for instance ://if defined like this :
typedef int BOOL;//this can be a mistake :
BOOL b = 4;
if (b == true) {
//never enters here
// because 4 != 1
}[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
modified on Tuesday, May 20, 2008 9:50 AM
toxcct wrote:
0x00000001 (true) or 0x00000000 (false).
Uhmmmmmmmmmmm. Never seen a byte having so much hex digits...:-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
humm, it was in the C days... but anyway, an
enum
is anint
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
I was just asking where was
BOOL
defined as anenum
. Since the C days, BOOL is an int and even the latest Windows SDK, it is so, to have C compatibility. I have never seen BOOL being defined as an enum in the Windows world.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
I was just asking where was
BOOL
defined as anenum
. Since the C days, BOOL is an int and even the latest Windows SDK, it is so, to have C compatibility. I have never seen BOOL being defined as an enum in the Windows world.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Rajesh R Subramanian wrote:
in the Windows world.
man, we are not alone ! ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
toxcct wrote:
0x00000001 (true) or 0x00000000 (false).
Uhmmmmmmmmmmm. Never seen a byte having so much hex digits...:-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkewhat ????? doesn't a Byte having 8 bits ?
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
toxcct wrote:
0x00000001 (true) or 0x00000000 (false).
Uhmmmmmmmmmmm. Never seen a byte having so much hex digits...:-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkehai all, about 'bool' i got idea... from all ur replies... but what about BOOL..? i am not clear...
Born to win...!
modified on Tuesday, May 20, 2008 11:57 PM
-
what ????? doesn't a Byte having 8 bits ?
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
But it hasn't 8 hexadecimal digits. I.e. I was kidding about your binary numbers prefixed like hexadecimal ones. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
But it hasn't 8 hexadecimal digits. I.e. I was kidding about your binary numbers prefixed like hexadecimal ones. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarkeyou're right, i fixed it.
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Maybe both my local help and my
windef.h
file are wrong?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeMay be toxcct is on drugs today for a change. :laugh:
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
May be toxcct is on drugs today for a change. :laugh:
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Rajesh R Subramanian wrote:
May be toxcct is on drugs today for a change
come on, have you ever worked under linux ? Microsoft IS NOT the standard, even if 85% of the PCs worldwide are windows based... :doh:
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
what ????? doesn't a Byte having 8 bits ?
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
toxcct wrote:
doesn't a Byte having 8 bits
Yes, so it is coded 0x00 to 0xFF (hexa representation) or 0b00000000 to 0b11111111 (binary representation).
Cédric Moonen Software developer
Charting control [v1.4] -
Rajesh R Subramanian wrote:
May be toxcct is on drugs today for a change
come on, have you ever worked under linux ? Microsoft IS NOT the standard, even if 85% of the PCs worldwide are windows based... :doh:
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
toxcct wrote:
come on, have you ever worked under linux ?
Yes, why?
toxcct wrote:
Microsoft IS NOT the standard, even if 85% of the PCs worldwide are windows based... [D'Oh!]
So, I don't get the point here. I have worked on development projects on fedora, debian and ubuntu. Linux does not have a BOOL datatype as far as I know. I say - BOOL belongs to Windows. Comments?
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP