Eric Sunshine writes:
>> diff --git a/sequencer.c b/sequencer.c
>> @@ -2849,10 +2849,14 @@ static int do_reset(const char *name, int len,
>> struct replay_opts *opts)
>> /* Determine the length of the label */
>> + for (i = 0; i < len; i++) {
>> +
On Sun, 28 Oct 2018 at 20:01, Eric Sunshine wrote:
>
> On Sun, Oct 28, 2018 at 11:32 AM Martin Ågren wrote:
> > [...]
> > Let's be explicit about breaking out of the loop. This helps the
> > compiler grok our intention. As a bonus, it might make it (even) more
> > obvious to human readers that th
On Sun, Oct 28, 2018 at 11:32 AM Martin Ågren wrote:
> [...]
> Let's be explicit about breaking out of the loop. This helps the
> compiler grok our intention. As a bonus, it might make it (even) more
> obvious to human readers that the loop stops at the first space.
This did come up in review[1,2
When we find a space, we set `len = i`, which gives us the answer we are
looking for, but which also breaks out of the loop through these steps:
1. `len = i`
2. `i = i + 1`
3. Is `i < len`? No, so break out.
Since `i` is signed, step 2 is undefined if `i` has the value `INT_MAX`.
It can't
4 matches
Mail list logo