|
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
|
|
|
|
|
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
|
|
|
|
|
May be toxcct is on drugs today for a change.
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...
|
|
|
|
|
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
|
|
|
|
|
toxcct wrote: have you ever worked under linux
What kind of drug is that ?
|
|
|
|
|
Cedric Moonen wrote: What kind of drug is that ?
i'd better give up there ! lol
|
|
|
|
|
I dunno. Azk CPallini. He'z da one who abuzez drug to answer queris realllly fazzt. He haz gud drugz and gud linkz. azk him plz.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I supposed too.
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
|
|
|
|
|
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 values 0b00000001 (true ) or 0b00000000 (false ).
you can assign an integer to a bool . if it is different from 0 , it equals the value "true ", and will be automatically converted into 0b00000001 anyway.
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
};
An enum is actually an int , 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 :
typedef int BOOL;
BOOL b = 4;
if (b == true) {
}
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 in Windef.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 an int
|
|
|
|
|
I was just asking where was BOOL defined as an enum . 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 !
|
|
|
|
|
toxcct wrote: 0x00000001 (true) or 0x00000000 (false).
Uhmmmmmmmmmmm. Never seen a byte having so much hex digits...
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
|
|
|
|
|
what ?????
doesn't a Byte having 8 bits ?
|
|
|
|
|
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
|
|
|
|
|
you're right, i fixed it.
|
|
|
|
|
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).
|
|
|
|
|
yes yes, fixed already
|
|
|
|
|
hai 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
|
|
|
|
|
BOOL is fully featured integer, for instance, you can do.
BOOL b;
b = 1000;
b++;
You can't do the same with a bool variable.
[added]
Well, I made a sanity check, and actually VC++ compiler gives just a warning on the following code
bool b;
b = 1000;
b++;
[/added]
As stated by someone (Rajesh ? toxcct?) this is a reminiscence of the C language gold ol days (C has not the bool keyword). Using an int to represent Yes/No pair is simply a matter of convention (and convenience).
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 one has to be careful with BOOL, as I stated at the end of my most here[^]
CPallini wrote: C has not the bool keyword
looks like it has[^]
|
|
|
|
|
toxcct wrote: but one has to be careful with BOOL, as I stated at the end of my most here[^]
Indeed. C language implicit mapping of non-zero values to true and zero value to false is more coherent.
toxcct wrote: looks like it has[^]
I saw it, but: shhhhhh, noone, except Nemanja, knows.
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
|
|
|
|
|
CPallini wrote: I saw it, but: shhhhhh, noone, except Nemanja, knows.
Oh come on. You are a "C" lover. I would have expected you to know.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|