Women in Technology

Hear us Roar



Article:
  What I Hate About Your Programming Language
Subject:   C, C++, Java, maybe others - zeroth element arrays
Date:   2003-05-14 09:29:51
From:   anonymous2
Response to: C, C++, Java, maybe others - zeroth element arrays

I will assume your response was *not* tongue-in-cheek. (I posted the message you replied to.)


Are you suggesting that *not* using zero means we may run out of digits? Ridiculous. Zero is not an element number - it is an offset.


This is an example of bending the humans to the machine, rather than bending the machine to the humans. IMHO, a fundamental mistake in the approach.

Full Threads Oldest First

Showing messages 1 through 5 of 5.

  • C, C++, Java, maybe others - zeroth element arrays
    2003-05-14 09:55:38  anonymous2 [View]

    The "Why waste a perfectly good digit?" bit was tongue-in-cheek.

    But I've been programming so long I really can't imagine not using zero. It's second nature to me now.
    • C, C++, Java, maybe others - zeroth element arrays
      2003-05-14 10:54:13  anonymous2 [View]

      why arrays indexed from zero? cos everybody is used to them. maybe if we all started indexing arrays from 1 back in the day it'd seem sensible, but it has become convention. i'd find it weird if i moved to a new language and found the arrays indexed from 1, it'd spongle all my for-loop logic & annoy me every time i forgot it.
      • C, C++, Java, maybe others - zeroth element arrays
        2003-05-14 14:39:09  anonymous2 [View]

        Naah, you don't really want me to reply with a list of languages that do suport arrays starting 'at one' do you:)
        Don't be worried if you ever encounter one though, those languages do not support for-loop logic either.
        You'll indeed need an all new logic:
        the first is in position one,
        the second is in position two,
        ...
        the Nth is in position N.

        Hey, I really do like C, but not really for business processing.
        • C, C++, Java, maybe others - zeroth element arrays
          2003-07-06 00:49:55  anonymous2 [View]

          FORTRAN and MATLAB both index from 1.

          I migrated from MATLAB to Numerical Python, just to get back to the sweet, nourishing 0 indexing.
      • There's a zeroth element?
        2003-05-14 13:08:17  anonymous2 [View]

        Maybe I'm backwards, but I rarely use the zeroth element. I do know that C and its pointer arithmetic is why there is a zeroth element. But unless the problem absolutely requires it, I just ignore it like a bit of grissle on my steak.