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-05 8:41

>>11
Of course they make sense from a low-level background, because C style arrays are designed to correspond with common machine instructions.

>>13
The C books teach something about pointers to the first byte of an element, which is an implementation detail of one possible implementation.
It's my understanding that that is not merely an implementation detail as far as C is concerned, it's a defined part of the language semantics, or at least that arrays must behave as if their elements are stored contiguously in memory. C does place fairly strict requirements on how features are implemented, because C is by design a minimalist language and unless its basic constructs are implemented consistently, more complex features built on top of those constructs won't be reliable. It's not the only way to make a language, but it is in line with the C philosophy. The mistake is in thinking that the qualities that make a low-level systems language will also make a good apping lang or a good scripting lang.

They also ``flatten'' variable-length multidimensional arrays into one dimension and you have to use multiplication to get the address, another implementation detail.
Because that is pretty much a requirement when it comes to treating arrays of arbitrary dimensions (or any object, really) as a block of contiguous bytes. It's an inherent part of how the whole C environment was designed. Not ideal for languages built with other models in mind, but it's perfectly reasonable within the context of C. The problem isn't C, C is perfectly good for its niche, the problem is that so many other languages end up being "C with design patterns", "C for the web", "C for dummies", "C with significant whitespace", "C with lazy evaluation", "C as a markup language" etc, etc.

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