On Mon, 02 Apr 2012 12:03:14 +0200, deadalnix <deadal...@gmail.com> wrote:

Hi,

I have a design question, or maybe it is a bug ? In D, == and != have the same precedence than comparisons operators. This isn't the case in C/C++ . Is it a design decision, made on purpose ? Is it a bug ?

DMD implementation and http://dlang.org/expression.html both agree on that.

I personally think it is a bug. This is a change in the behavior of C/C++ with no legitimate reason. Or at least with no legitimate reason I can come up with.

It's there to force proper parenthezation:

1 <= 3 == 2 > 3 != 3 < 1
vs
((1 <= 3) == (2 > 3)) != (3 < 1)
vs
(1 <= (3 == 2)) > ((3 != 3) < 1)

Reply via email to