Is 'Option Base #' a good thing?

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 3074 Views - Last Post: 05 March 2012 - 09:03 AM

#16 lordofduct   User is offline

  • I'm a cheeseburger
  • member icon

Reputation: 2668
  • View blog
  • Posts: 4,786
  • Joined: 24-September 10

Re: Is 'Option Base #' a good thing?

Posted 05 March 2012 - 09:03 AM

View Postccubed, on 01 March 2012 - 07:06 PM, said:


View PostRhymer, on 24 February 2012 - 03:43 PM, said:

Who likes zero based and who likes one based arrays?[/size]

Zero, because one based arrays are an annoyance that should burn. Bytes start at 0, Binary starts at 0, arrays should start at 0 because the first number in binary is not 1, it's 0.

Binary starts at 0? Binary is just a counting system that uses only a combination of 2 digits (the bi in binary) in an exponential series (each 'place' in the character string represents a value of the base [2] raised to the power of it's position).

Binary doesn't 'start' at 0 any more than decimal, octal, hexadecimal, roman numerals, greek numerals, babylonian numerals, or any other counting system starts at 0.

The person counting decides at what number they start counting. I could start counting at 5,384 if I wanted! That's just a ridiculous number to start at. 0 and 1 are just more convenient starting points...

I actually deal with a couple of systems here at my work that do use a 1-based index for array collections. They are not dead systems like vb6, they're alive and well.

As for OP's suggestion. I'd say no to ALL languages having such a thing. If a language wants to supply such a capability that's all fine and well (which I bet one exists somewhere out there, shit I may even write in one and have no idea it exists), but the idea that this should be common place just leaves the door open for shared libraries to fight over the 'base', or have to have some layer of abstraction between libraries to deal with such nuances, and general standards would just cause them to balance back out to the often agreed upon 0-based index.

If you so want it, write your own collection for it, most all languages have this ability.

This post has been edited by lordofduct: 05 March 2012 - 09:04 AM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2