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: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 :-)

Ideally lint on amd64 would have warned also; that would have avoided
the broken build...

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


Home | Main Index | Thread Index | Old Index