If the unsigned quantity can be expressed as a signed
quantity, then all is well. The only undefined behavior
(implementation specific) is if it can't be. However,
the conversion from a non-0 quantity to a 0 would
be extremely unlikely. You'd get an unexpected signed
value, but I can't imagine any compiler turning it
into a 0!

On Jan 8, 2014, at 10:57 AM, Yann Ylavic <ylavic....@gmail.com> wrote:

> On Wed, Jan 8, 2014 at 2:03 PM, Jim Jagielski <j...@jagunet.com> wrote:
> 
> On Jan 7, 2014, at 3:15 PM, Jeff Trawick <traw...@gmail.com> wrote:
> >
> > +1 for APR trunk, +0.9 for future APR 1.6.x, -0.9 for APR 1.5.x...
> >
> > alternate opinions?
> >
> 
> As far as I know, C guarantees that
> 
>         if (a)
> 
> is the same as
> 
>         if (a != 0)
> 
> So I'm unsure of the need for this patch.
> 
> The real question is, for an "unsigned a != 0", can "(int)a" become 0 after 
> an implicit (undefined) conversion?
> 
> Regards,
> Yann.

Reply via email to