Source-Changes-D archive

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

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



On Sun, Mar 13, 2011 at 07:40:45AM +0000, matthew green wrote:
>       src/lib/libc/gen: unvis.c
> 
> Log Message:
> cast "~0" to (size_t) when passing to a size_t taking function.
> fixes lint build errors.

Is that right? My C promotion rules are getting rusty...
~0 is of type 'int', 'size_t' is an unsigned type, if 'size_t' is
larger than 'int' isn't the convertion 'value preserving' rather
than 'sign preserving'?
So you need ~(size_t)0 if you want to generate the all 1's bit pattern?

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index