On Fri, Nov 25, 2011 at 01:44:24PM +0000, David Holland wrote: > On Fri, Nov 25, 2011 at 02:29:12PM +0100, Joerg Sonnenberger wrote: > > > > > Sure it does. You should just have written the code using (size_t)1, > > > > > or even just 1UL, instead of 1ULL. There is no port where size_t is > > > > > unsigned long long. > > > > > > > > > > ... Unless what you meant was "get rid of all 32-bit ports" :-) > > > > > > > > Well, there is Win64 and this is essentially portable code... > > > > > > so use (size_t)1 then. > > > > Point remains that the original code is correct and no overflow can > > happen. As such lint's behavior is just bogus. > > Warning about 64->32 truncation is useful. Coding to avoid unnecessary > ones is straightforward. I think you're complaining only because you > got caught out by it :-)
Which part of "it can't truncate" is hard to understand? I am complaining because it is no reason to error out. Joerg