Source-Changes-D archive

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

Re: CVS commit: src/lib/libc/string



On Fri, Nov 25, 2011 at 02:48:30PM +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.

And why should the/any static analyzer have to figure that out when
coding it right makes it a nonissue?

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index