Remix.run Logo
▲ randomblock1 4 hours ago

I thought most people used the explicit version:

  for (size_t i = count; i > 0; --i) {
      // use array[i - 1]
  }
You can also do something like:

  size_t index = i - 1;
to not have to use i-1. I believe the compiler optimizes that out anyway to be identical.
▲seeknotfind 4 hours ago | parent [-]

Yes, this is the best answer. This also works with `-fsanitize=unsigned-integer-overflow`.