| Article: |
What I Hate About Your Programming Language | |
| Subject: | C, C++, Java, maybe others - zeroth element arrays | |
| Date: | 2003-05-14 17:50:13 | |
| From: | anonymous2 | |
|
Response to: C, C++, Java, maybe others - zeroth element arrays
|
||
|
You and all the other replies seem to forget the most important thing: an array index measures the distance of the element from the beginning of the array. If you think otherwise, try to write a piece of code that maps a 6 dimension array into a the memory (which is a one dimension array) in a language that starts indexing with 1.
|
||
Showing messages 1 through 2 of 2.
-
C, C++, Java, maybe others - zeroth element arrays
2003-05-15 11:55:38 anonymous2 [View]
-
C, C++, Java, maybe others - zeroth element arrays
2003-05-15 00:33:37 anonymous2 [View]
This is like saying a hole in the ground is better than a flushing toilet, it is giving you what you want and is less difficult to implement. And what if you are on rocky ground?
I do not need to care about implementing multidimensional arrays into memory (that's the compilers task, right?), I just want to express my thoughts in the language easily. No cupboard in my house has a zeroth shelf.



the most important thing: an array index measures
the distance of the element from the beginning
of the array."
First of all, the distance is not the element number, it is the multiple of the element number times the size of an individual element in bytes.
Regardless of that, here is where I disagree with you completely. The array index is for the PROGRAMMER. The offset is for the MACHINE. Becoming accustomed to thinking this way has nothing to do with the original point - which was that this is bending the humans to the machine rather than the other way around.