Allowing Expressions such as (low < value < high)

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 4 13:33:44 PDT 2014


On Thursday, 4 September 2014 at 20:25:52 UTC, monarch_dodra 
wrote:
> In the case of D, it's a C compatibility thing. Other languages 
> I don't know.

FYI,

     auto x = 1 < 2 < 3;

as C++ is accepted (but warned about) by GCC as

x.cpp:19:20: warning: comparisons like ‘X<=Y<=Z’ do not have 
their mathematical meaning [-Wparentheses]
      auto x = 1 < 2 < 3;

Clang gives no warning.


More information about the Digitalmars-d-learn mailing list