TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JASON HENDRIKS
from: WIM VELDHUIS
date: 1997-03-24 21:36:00
subject: Bit Fields

Jason Hendriks wrote in a message to Rick Bischoff:
 RB> Does anyone know how to declare a variable that holds 
 RB> only one bit of information.. (You know only two values 
 RB> (0 or 1)) ???
 JH> A very useful header file..
 JH> // BOOLEAN.H
 JH> enum boolean{false, true};
 JH> inline boolean operator!(boolean bState)
 JH> {  return (bState == true ? false : true);  }
I am not sure, but I would code this otherwise. I would do the comparison to 
false, as this is the only defined boolean value in C (false is equal to 
zero, everything else is considered true). This just in case to return 
correct results for an incorrect cast to a boolean.
mvg/wr
  
--- timEd/2 1.01.g3+
---------------
* Origin: LightHouse BBS ==> I am a H.U.G.O. Member ! (2:285/324.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.