Lots of bool operations shouldn't compile
    Don Clugston 
    dac at nospam.com.au
       
    Wed Mar  1 07:30:46 PST 2006
    
    
  
Oskar Linde wrote:
> (But note that the current D bool is (sans bugs) semantically identical 
> (as far as I can tell) to C99 and C++ bool, who both allows b+=5, et.al.)
I just tried that in MSVC, and you're right. I didn't know that. It's 
probably a legacy of the pre-bool days when ints or BOOL were used. In 
practice, I doubt it's really much of a problem. But there doesn't seem 
to be any rational reason to allow them.
BTW, MSVC accepts
bool b = true;
b /= false;  // crashes at run time with a div by zero error
but gives a warning for
bool b = true/false; // Can this be constant folded? What the heck does 
it set it to?
Also accepts b/=6.5;
Wonder what b/=real.nan does.
    
    
More information about the Digitalmars-d-bugs
mailing list