I have always assumed that is just one less operation required to resolve the absolute memory address.
No. 1. Optimizing compilers exist. 2. Addressing at fixed offsets is cheap (a single instruction): https://en.wikipedia.org/wiki/Addressing_mode 0-based indexing is superior (as a default) because it simplifies a lot of common math, as discussed in TFA.
Why do arrays start at 0?
81–90 of 702 posts
Re: Why do arrays start at 0?
#82Earlier quoted context omitted.
Yes, exactly. One of which carries an implicit zero indexing. The date of birth doesn't disappear just because you decided to use a different measuring device.
No, it doesn’t carry an implicit 0 index. Measuring age (in the West) is like measuring distance. You start at 0, but that doesn’t mean the first item is at index 0.
Re: Why do arrays start at 0?
#83It really comes down to a choice between a machine-focused (0) or human-focused (1) approach. The 0 makes a lot of sense in a C pointer world where memcpy and other alike functions can be written very thight. The 1 makes a lot of sense in a human world, when we count, we start at 1, we talk about the "1st", counting on finger starts with 1, etc. I once were at a Lua (1 indexed language) conference where this was disc…
> It really comes down to a choice between a machine-focused (0) or human-focused (1) approach. Just think of 0-based as offset-based and 1-based as index-based. Both are intuitive just like that. I never get why people arguing over this bring pointers and memory (or anything computer related) to the table. No normal person is going to understand that, but everyone understands that if you don't move at all (0 offset)…
Re: Why do arrays start at 0?
#84This reminds me of arguments about male -> female and man -> woman (and human etc). Without offending anyone's delicate sensibilities - you may note that there is a short version and long version of those words, suggesting that the longer version is derivative of the short version. However, when you examine the origin of the words, that is not the derivation. The derivation and path to English is quite complicated. Y…
Re: Why do arrays start at 0?
#85It really comes down to a choice between a machine-focused (0) or human-focused (1) approach. The 0 makes a lot of sense in a C pointer world where memcpy and other alike functions can be written very thight. The 1 makes a lot of sense in a human world, when we count, we start at 1, we talk about the "1st", counting on finger starts with 1, etc. I once were at a Lua (1 indexed language) conference where this was disc…
> when we count, we start at 1, we talk about the "1st" Although often with an implicit zero. Under typical North American culture, your 1st birthday, for example, is more accurately the first anniversary of your birthday. Your birth is zero indexed.
Re: Why do arrays start at 0?
#86Re: Why do arrays start at 0?
#87It really comes down to a choice between a machine-focused (0) or human-focused (1) approach. The 0 makes a lot of sense in a C pointer world where memcpy and other alike functions can be written very thight. The 1 makes a lot of sense in a human world, when we count, we start at 1, we talk about the "1st", counting on finger starts with 1, etc. I once were at a Lua (1 indexed language) conference where this was disc…
> when we count, we start at 1, we talk about the "1st" Although often with an implicit zero. Under typical North American culture, your 1st birthday, for example, is more accurately the first anniversary of your birthday. Your birth is zero indexed.
Re: Why do arrays start at 0?
#88Indexes start at 1. Offsets start at 0. Arrays in programming use offsets. for(int i=0;i The error here is calling it 'i' for index. It should be 'o' for offset.
Arrays in the programming languages you’re familiar with use offsets. Not all do [1]. 1. https://therenegadecoder.com/code/which-programming-language...
The point is that offsets and indexes have different meaning.
Re: Why do arrays start at 0?
#89This reminds me of arguments about male -> female and man -> woman (and human etc). Without offending anyone's delicate sensibilities - you may note that there is a short version and long version of those words, suggesting that the longer version is derivative of the short version. However, when you examine the origin of the words, that is not the derivation. The derivation and path to English is quite complicated. Y…
I really fail to understand what the etymology of sex and gender classifications has to do with array based indexing.
The linked post is not just about a technical decision, it's about a social history.
The conclusion of the linked post:
> "Lessons
Things can have more than one cause. Don’t trust easy explanations.
Always look for information that refutes your theory, not just information that supports it. Hoye stopped as soon as he had a satisfying answer and didn’t keep researching.
Don’t be a dick.
It is tragically easy to trick me into doing free research."