"but checking for 'i > 0' or 'i >= 1' as the condition in the for loop, rather than 'i>=0', would work wouldn't it?"
That depends on whether you need to do anything within the body of the loop when i is 0.
I've been caught out a few times with the unsigned int, typically...
std::vector< sometype> a_vector;
...
int length = a_vector.size();
for ( int i = 0; i < length; i++ )
{
do something with a_vector[i]; // Yes, I know an iterator would probably work too in this case.
}
This will typically give a compiler warning as the size type is unsigned (although it will work counting up or counting down), so in an attempt to remove compiler warnings, the alternative:
std::vector< sometype> a_vector;
...
unsigned int length = a_vector.size();
for ( unsigned int i = 0; i < length; i++ )
{
do something with a_vector[i];
}
will compile without the unsigned -> signed conversion warning.
Being unsigned normally works, and it becomes automatic to use it, specially if your code is counting up most of the time, until you have a situation where you have to work from the end of the vector towards the beginning, and forget about the wrap-around on:
for ( unsigned int i = length-1; i >=0; i-- )