What I Hate About Your Programming Language
Subject:   C, C++, Java, maybe others - zeroth element arrays
Date:   2004-02-16 10:42:43
From:   andrewjmarshall
Response to: C, C++, Java, maybe others - zeroth element arrays

Here's the final answer and I DON'T want to hear any arguments, because they're WRONG.

For low/machine-level languages, arrays should be zero-based. There's too many technical reasons for this to argue against.

For ALL other languages, array bounds should be CONFIGURABLE. Sometimes you want zero-based (freaks), ALMOST ALWAYS you want one-based, and sometimes you want a custom base. Let's remember one of the prime tenets of OO - Encapsulation or keep your users insulated from your implementatation. Why screw your programmers because it's "easier" for the compiler? F*** the compiler! Why is it my job to make the compiler's life easier?

I spent 2 hours arguing this point with my brother-in-law (a UVa Computer Engineering grad), and he lost. So there!

Hugs and kisses,