(int << ulong) == int ?

bearophile bearophileHUGS at lycos.com
Sun Aug 7 15:07:40 PDT 2011


Dmitry Olshansky:

> Sorry for the noise.

It's not noise, and you don't need to be sorry, in my opinion it's a D/DMD design fault. Clang gives an error on code like that:
http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html

See the error:
example2.cc:12:25: error: shift result (10737418240) requires 35 bits to represent, but 'int' only has 32 bits [-Werror,-Wshift-overflow]
long kMaxDiskSpace = 10 << 30;

In my opinion D has to give a similar error.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list