Static Analysis Tooling / Effective D
Marco Leise via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 24 05:49:30 PDT 2014
Am Thu, 24 Apr 2014 13:11:18 +0200
schrieb Artur Skawina via Digitalmars-d
<digitalmars-d at puremagic.com>:
> `size_t x = 1 << shiftAmount` is definitely not something that
> should be recommended, see above. Just use the correct type on
> the lhs of shift operators.
auto x = cast(size_t) 1 << shiftAmount; // really ?! :(
In that case it is better to define ONE as a constant :)
enum ONE = cast(size_t) 1;
auto x = ONE << shiftAmount;
--
Marco
More information about the Digitalmars-d
mailing list