Re: [hackers] [sbase] Do not rely on `s' being incremented before taking the address of it || sin

From: Rob <robpilling_AT_gmail.com>
Date: Thu, 10 Oct 2013 20:11:35 +0100

On Thu, Oct 10, 2013 at 05:58:55AM +0200, Roberto E. Vargas Caballero wrote:
> > Exactly, 'values of the same object' - there's only one value
> > calculation, the other is taking the address.
>
> Uhmmmm, your right, the address of the variable is not affected by the
> increment :).
>
> And my patch was also incorrect, the correct is only:
>
> - r->max = (*s == '-') ? strtoul(++s, &s, 10) : r->min;
> + r->max = (*s == '-') ? strtoul(s + 1, &s, 10) : r->min;
>
> strtoul modifies the value of s, so you don't need increment it. Actually
> using s++ is a no sense here, because you are not going to use this new
> value of s anymore, so, why storing it?

Heh yeah I suppose that renders the point moot, good spot.


Kind regards,
Rob
Received on Thu Oct 10 2013 - 21:11:35 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 10 2013 - 21:12:36 CEST