S
Stephen Sprunk
Mark L Pappin said:English is strange.
"a" has many possible meanings, and which one is appropriate is
determined by context.
In the original statement (which I don't recall having seen other than
as the subject of dissection in this sub-thread), the writer might
have meant either "every" or "any". "any" makes the statement
trivially false (as you pointed out, 0 is a valid index and 'int' can
certainly hold that value); "every" makes the statement true.
As the writer of that statement, I meant it to mean "there exist potentially
valid array index values which will not fit in an int".
Now, if you know with absolute certainty that your program cannot generate
such values, then it may be safe to use int, but such assumptions often
prove untrue after the program evolves for several years.
Take, for example, the NASDAQ ECN protocol where trade numbers are
represented as six digits; that was considered far more than could possibly
happen within a day, but during the dot-com bubble there was a day where
over a million trades happened and every ECN and most broker systems crashed
and/or lost hundreds of thousands of transactions; it took days of manual
labor to sort out that and weeks to rebuild all the systems to handle a
rollover.
Most people are not creative enough to discern the difference between
"impossible" and "unlikely". Things which are "impossible" happen with
surprising regularity in the real world.
S