|
|
|
|
|
by detrino
3996 days ago
|
|
I am addressing the specific example given by the Google style guide. The code for counting down using a signed integer as they do has more corner cases than the while loop I have shown. Using their way, you have to remember to subtract 1 from the size at the start and then use >= in the loop conditional. My way is just the inverse of what you do while counting up. It's also worth pointing out the style of loop they give can't be used at all if you are counting down iterators or pointers instead of numbers. |
|