(int << ulong) == int ?
Dmitry Olshansky
dmitry.olsh at gmail.com
Sun Aug 7 15:37:11 PDT 2011
On 08.08.2011 2:07, bearophile wrote:
> 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.
>
It's useful but not a panacea. I presented a simple trimmed down example
with consts, I don't think compiler can reliably identify the problem in
my actual code.
--
Dmitry Olshansky
More information about the Digitalmars-d-learn
mailing list