tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing lint warnings

On Fri, Mar 23, 2012 at 10:09:41PM +0000, David Laight wrote:
> > In fact, I believe the cast should *only* be added if it is intended to
> > mark the implicit cast as potentially not value preserving.
> And even then there are cases where casts are only confusing.
> Consider the following:
>       byte[0] = foo;
>       byte[1] = foo >>= 8;
>       byte[2] = foo >>= 8;
>       byte[3] = foo >> 8;
> which quite unambiguously convers a value to little-endian bytes.
> It doesn't need any casts, nor any explict '& 0xff';

Sure. My point for the above was that it makes sense to have an option
to trap on non-value preserving implicit casts. If we get something like
that, I would see it as reasonable to attribute the above with either
cast or mask.


Home | Main Index | Thread Index | Old Index