Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C is a big 0

Name: Anonymous 2017-08-04 4:47

https://softwareengineering.stackexchange.com/questions/110804/why-are-zero-based-arrays-the-norm

1-based counting was ``the norm'' for thousands of years. Years begin at 1. The Bible counts chapters and verses from 1. Programming languages before C started arrays from 1 or a user-defined index.

Only a few answers mention that some programming languages let you start from 1. This should be filled with answers saying ``1-based arrays used to be the norm and C hackers came along and forced everyone to use the C way because they get confused if you let them choose the index.'' Stupid questions do not bother me, but wrong answers do. Stack Overflow and Stack Exchange are spreading wrongness into the world. They are reducing the amount of truth on the Internet.

They all say that arrays count from 0 and nobody can change it because it would ``confuse'' people. This is the C mentality. They want to force their 0 on thousands of years of human history and on every non-C-based programming language. They want everyone else to cater to them because they are too dumb. Pascal programmers can learn and use C. They don't like it, but they can get used to it. C programmers don't want to use Pascal because it's not C.

Stop catering to the idiots. They are not good programmers if they get confused by simple concepts like array base. Kids using QBasic and Pascal can understand it, but these C ``expert hackers'' can't. We should stop dumbing down our languages and debasing important computer science concepts because some people are stupid.

Name: Anonymous 2017-08-11 18:24

>>41,42
Hardware counts from whatever number you choose and C isn't 0-based counting either. C array dimensions and data sizes count from 1 like most everything else. int a[10] declares 10 items (counting from 1) but indexed 0 to 9. sizeof(char) is 1, not 0. C makes it confusing because it's unnatural and this is why there are so many off-by-one errors. If you need more proof that it's unnatural, C requires you to be able to form a pointer to the byte after the end of the array.

0-based arrays and 1-based arrays are both special cases of what an array is, sort of like a chicken is a special case of an animal. If your idea of ``animal'' is a chicken, you might think elephants and crocodiles aren't animals, but they are. That's essentially what is going on with CS education. They focus on very limited special cases that dumb you down.

Arrays are a computer science concept that existed before there were high-level languages. Recursion was a computer science concept before programming languages supported it. Traditional programming languages start counting from the lower bound because that is the part of the high-level concept of arrays. The lower bound is usually 1 because the number of elements, the last indexable element, and the number you stop counting at are the same. dim a(0 to 9) counts from 0 to 9 giving 10 elements, real 0-based counting. In Pascal, they don't even have to be numbers. You can count from Monday to Friday or Red to Violet. All of these concepts are part of what an array is, but not all of what an array is.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List