This issue is inspired by bug 3918.

float f;
if (f) ...

This currently compiles, but if the condition is true, what can you conclude about f?
Obviously it's not zero, but can it be NaN?
If it's just translated to:  if (f!=0) ..., then f could be NaN.
Likewise, if (!f) ... is NOT triggered if f is NaN.

I find that rather unintuitive, and I can't easily invent a case where it is useful.

As bug 3918 shows, this conversion has never worked properly. Most existing code that makes use of it is probably broken.

`cast(bool)f` has the same problem. I don't think it should compile. And compared to `f != 0`, it's very unclear.

This conversion seems to be confusing, bug prone, and not useful. Can we just get rid if it?

Reply via email to