Lots of bool operations shouldn't compile
Kyle Furlong
kylefurlong at gmail.com
Tue Feb 28 16:44:28 PST 2006
Don Clugston wrote:
> Four examples, although it's only one bug. Almost all operations on bool
> should be disabled, but I found the ones below a little amusing. None of
> them should compile, but they all evaluate as "true".
>
> void main()
> {
> if (true >= ireal.nan) { writefln("This is kind of ridiculous"); }
> if (false >= ireal.nan) { writefln("This is kind of ridiculous"); }
> if (true <> -2i) { writefln("NCEG operators too ??!!"); }
> if (false != -2i) { writefln("and again"); }
> }
This kind of absurdity is exactly what Derek and others of us have been arguing against. These are a direct result of a non type
safe boolean.
More information about the Digitalmars-d-bugs
mailing list