Bool {post,pre}{inc,dec}-operators

Kyle Furlong kylefurlong at gmail.com
Tue Feb 28 16:45:44 PST 2006


Oskar Linde wrote:
> bool a = 0;
> --a;
> assert(a == false || a == true); // FAILS(!) (a is set to 255)
> 
> bool t = true;
> bool b = t+t;
> assert(b == true); //OK
> bool c = 0;
> c++;
> c++;
> assert(c == true || c == false); // FAILS
> 
> But:
> 
> bool d = 0;
> d += 2;
> assert(d == true || d == false); // OK
> 
> /Oskar

This makes me sick to my stomach. I thought D was a beautiful language, but now I dont know.



More information about the Digitalmars-d-bugs mailing list