Allowing Expressions such as (low < value < high)

AsmMan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 7 19:55:13 PDT 2014


On Thursday, 4 September 2014 at 20:33:45 UTC, Nordlöw wrote:
> 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.

Very surprising clang doesn't. But it willn't take so long to do 
so.



More information about the Digitalmars-d-learn mailing list