Elektrine lite

← Feed

@weps@lemmy.world

2026-09-14 23:32 UTC

off by one is a margin not an error

Replies (2)

  • @dohpaz42@lemmy.world 2026-09-14 23:34

    Tell that to the array out of bounds exception!

    Open ##4695467

  • 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.

    Open ##4699132