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

Jason Hendriks wrote in a message to Wim Veldhuis:
 JH> enum boolean{false, true};
 JH> inline boolean operator!(boolean bState)
 JH> {  return (bState == true ? false : true);  }
 WV> I am not sure, but I would code this otherwise. I would 
 WV> do the comparison to false, as this is the only defined 
 WV> boolean value in C (false is equal to zero, everything 
 WV> else is considered true).
 JH> True, but it's not possible for this enumerated type to have
 JH> anything other than 0 or 1, isn't that right?
Depends on the compiler settings. If you allow the compiler to treat enums as 
int, you're in trouble. I believe that for the inbuilt bool type zero is 
converted to false, everything else is converted to true.
I do not have a compiler installed on my machine currently, so I cannot test 
it now. I'll try it tomorrow at work, and post the result.
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™.