off the trolley = O = offline

off-by-one error n.

[common] Exceedingly common error induced in many ways, such as by starting at 0 when you should have started at 1 or vice-versa, or by writing < N instead of <= N or vice-versa. Also applied to giving something to the person next to the one who should have gotten it. Often confounded with fencepost error, which is properly a particular subtype of it.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

An idea that often comes up in computer programming, where a program can generate all sorts of errors due to a miscount by one. Such a mistake is made by the programmer, not the program, of course -- the computer only does what the programmer tells it to do.

This error occurs often because the program counts starting at zero when it should have been told to start counting at one, or vice versa. We humans have the natural tendency to start counting at one, but it is more natural to start counting at zero in the computer world, so a program that's used in any real-world application has several places where it counts starting at one and others where it counts starting at zero. All these mix-and-match situations can become very confusing for the programmer, and s/he can make mistakes, resulting in the off-by-one error.

Such an error in a program can be hard to detect, and many may not be detected for years, or ever. Such an error can be the source of a general protection fault that can crash systems or create a buffer overflow bug that can create security problems. Sometimes it simply makes a program behave in unexpected ways.

Log in or register to write something here or to contact authors.