Is there ANY chance we can fix the bitwise operator precedence rules?

bearophile bearophileHUGS at lycos.com
Fri Jun 18 14:57:37 PDT 2010


bearophile:
> >>> 1 < 5 < 10
> True

It's especially useful when the value in the middle is the result of some function call:

if 1 < foo(5) < 10: ...

In D you have to use a temporary variable:
auto aux = foo(5);
if (1 < aux && aux < 10) { ...

Bye,
bearophile


More information about the Digitalmars-d mailing list