this post was submitted on 14 Sep 2026
268 points (96.9% liked)

Programmer Humor

33385 readers
1046 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] weps@lemmy.world 5 points 2 weeks ago (2 children)

off by one is a margin not an error

[–] dohpaz42@lemmy.world 18 points 2 weeks ago

Tell that to the array out of bounds exception!

Off-by-one errors are real errors. A common mistake rookie developers make (or used to make, anyway) is forgetting that arrays are zero-indexed when creating an array, then seeing the value that should be in array[n-1] when they read array[n].

Another common off-by-one error is double counting: Some accumulators don't do all their processing in the same function, and occasionally one thing will be checked for inclusion twice, causing the accumulator to have one more element than it should.