Branko Čibej wrote:
-      for (r = range->start + 1; r <= range->end; r++)
+      for (r = (int)range->start + 1; r <= (int)range->end; r++)

I really don't like this kind if papering over warnings with typecasts.
Instead, change the type of 'r' to match the types of 'range->start' and
'range->end'.

Can do. In fact that was the first thing I did. I do agree in general casts are the worst way. Then having changed the loop variable type here, I looked at the other instances nearby where I use a revision number to subscript this array:

rangelist_array_union(rl_array_t *ma, ...)
{
  int r;

  for (r = 0; r <= RANGELIST_TESTS_MAX_REV; r++) {
    ma->root[r] = ...
}

rangelist_array_equal(const rl_array_t *ba, ...)
{
  int r;

  for (r = 0; r <= RANGELIST_TESTS_MAX_REV; r++) {
    if (ba->root[r] ...
}

and thought then it looked marginally better to keep using 'int' in those places (because they're low level operations on the array and don't care whether the index represents a revision number), and better to keep consistent than to just change the loop variable in one of the three functions. But it makes at least as much sense to me the way you suggest, so I'm happy to change it.

http://svn.apache.org/r1872115 .

- Julian

Reply via email to