Should I use zero-based index or one-based index

Правка en2, от LelouchRiBritannia, 2016-07-21 07:56:50

Could someone give me some advice?

In Pascal, I usually see people using one-based index.
But in C++, everyone prefers zero-based index.

I know each has its own advantages.
I find it hard to use one-based index in forming formulas because I have to add and subtract 1 all the times.
In zero-based index, this is not a problem but sometimes because the first element is zero, so if I want to use some initial values I have to set it to negative, for examples -1, but the issue is I have to check the overflow of the value because I cannot index negative value.

I want to get used to just one type, so anybody can give me more ideas before I do it?
Thank you.

Теги zero-based, one-based

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский LelouchRiBritannia 2016-07-21 07:56:50 24
en1 Английский LelouchRiBritannia 2016-07-21 07:55:43 718 Initial revision (published)