RE: [Dev-C++] thruth or consequences
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2001-01-05 13:44:04
|
true, false (and not TRUE, FALSE) exist in C++ as possible values of bool type which is fundamental type (*built in* as char, int, e.t.c.). From Bjarne Stroustrup's "The C++ programming language" Special Edition page 75: This is what is guaranteed about sizes of fundamental types: 1=sizeof(char)<=sizeof(short)<=sizeof(int)<=sizeof(long) 1<=sizeof(bool)<=sizeof(long) sizeof(char)<=sizeof(wchar_t)<=sizeof(long) (My note: wchar_t is *also* fundamental type in C++) sizeof(float)<=sizeof(double)<=sizeof(long double) sizeof(N)=sizeof(signed N)=sizeof(unsigned N) --- end of paste --- When a bool type is converted to an integer type true is concerted to 1 and false to 0. When an integer type is converted to bool, 0 is converted to false and !=0 is converted to true. E.g.: bool x=true; int y=x; // y==1 y=-10; x=y; //x==true x=0; //x==false Ioannis > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...]On Behalf Of Alan Thomas > Sent: Friday, January 05, 2001 2:07 PM > To: dev...@li... > Subject: [Dev-C++] thruth or consequences > > > Are TRUE and FALSE provided somewhere as a standard definition > in a C++ library or something? I have been defining them myself, > but now I > have problems with multiple definitions or something in header > files. When > I remove the multiple definitions, then TRUE and FALSE are no > longer defined > in "this scope." > Thanks, Alan > > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users > |