Zero based indexing gone too far



  • Alright, zero based indexing has really gone too far this time:

    SQL Server 2008 Release Candidate 0

     



  • I really hate zero-based indexing.  Can't we move on beyond this?



  • @morbiuswilters said:

    I really hate zero-based indexing.  Can't we move on beyond this?
     

    Obviously, you don't understand how pointers work. Get a C book.



  • This isn't new. They did it for Windows Server 2008, too.



  • @DrJokepu said:

    @morbiuswilters said:

    I really hate zero-based indexing.  Can't we move on beyond this?
     

    Obviously, you don't understand how pointers work. Get a C book.

    I do understand the reasoning.  It's because C is barely-abstracted assembly and we still haven't moved beyond memory offsets for specifying an index.  It's still fucking retarded. 



  • @bstorer said:

    This isn't new. They did it for Windows Server 2008, too.
     

    Agreed, but I am tired of seeing it.

    It is really ridiculous now.



  • It can't tell if you're being sarcastic or not. One of the best things about 0-indexing in higher level languages is the ability to access elements at the end of an array with a negative integer (i.e. -1 is the last element). Obviously this wouldn't work with 1 based indexes and would be a major step back in useability.



  • yes because let's do one additional subtract-immediate operation every time we do an array index... it won't add up to billions of instructions or anything

     

    You must generate some good WTFs with your total disregard for TECHNICAL reasons for doing things.

     



  • @duder said:

    It can't tell if you're being sarcastic or not. One of the best things about 0-indexing in higher level languages is the ability to access elements at the end of an array with a negative integer (i.e. -1 is the last element). Obviously this wouldn't work with 1 based indexes and would be a major step back in useability.

    Why the hell do you think this wouldn't work if arrays were 1-indexed? What effect would that have on anything?



  •  Well, it could work...

    array[1] is the first element

    array[-1] is the previous element

    array[0] is lost somewhere in space-time.

    &array[2] = &array[1] + 1;

    BUT &array[1] = &array[-1] + 1;

    Who cares about inconsistencies? Go code PHP FFS :P.



  • @Kazan said:

    yes because let's do one additional subtract-immediate operation every time we do an array index... it won't add up to billions of instructions or anything
    Oh, noes! Billions of instructions! That's like, seconds of lost time! Do you really think that high-level languages are concerned primarily with performance anyway?



  • @Kazan said:

    yes because let's do one additional subtract-immediate operation every time we do an array index... it won't add up to billions of instructions or anything

     

    You must generate some good WTFs with your total disregard for TECHNICAL reasons for doing things.

     

     

    Please use the quote button. You could be referring to just about anyone here.



  • @Kazan said:

    yes because let's do one additional subtract-immediate operation every time we do an array index... it won't add up to billions of instructions or anything

     

    Are you serious or is this just a flamebait?



  • @MasterPlanSoftware said:

    Please use the quote button. You could be referring to just about anyone here.

     

    Oh, here we go again... 



  • @morbiuswilters said:

    I really hate zero-based indexing.  Can't we move on beyond this?

    $[++;



  • @Kazan said:

    yes because let's do one additional subtract-immediate operation every time we do an array index... it won't add up to billions of instructions or anything
     

    Why would you have to execute an add instruction? If it's defined to work this way in the language, the compiler can take care of this. For example, you can store the memory address minus one for array references.

    You don't really want to move away from 0-based indexes, as that's what is commonly used in mathematics. Unfortunately the one program that tried to 'simplify' indexing is Matlab, which starts indexes at 1, which makes entering (0-based) formulas needlessly confusing.



  • @morbiuswilters said:

    I really hate zero-based indexing.  Can't we move on beyond this?

    Zero indexing is how computers work, and it makes the most sence. Most languages (except VB and a few other POS languages) use 0 indexing. Think about it, if an index is an offset of the array, it follows that 0 is the first element because it has an offset of nothing, and 1 has an offset of one and therefore is the element after the first. Now, when presenting offsets to users, how hard is it to just add one to the index? For example, in a mysql query you use the LIMIT clause, and LIMIT 0, 30 is the first page with 30 elements per page. When making the query in the back end, its much simpler to call that page 0 (instead of 1 - 1); but when showing the use which page it is on, it is not hard to just add one so that page is 1 instead of 0.

    Also, many people use languages like C++, where you have to deal with pointers. In that case, 0 indexing is a must, as in C++ vectors or C++ 'arrays' the pointer always points to the first element, and an offset of zero is the same as using the pointer directly.

    I see no single good reason why we should use 1-indexed arrays, and many reasons not to. The first of which is that you will encourage high level/scripting language developers to use a different scheme of indexing arrays then unmanaged/low language developers, and because I program in both C++ and C#/PHP/JavaScipt/Perl - it would just make language switching more difficult.

     Please give meone good reasen why 1-indexing is a good idea.



  • @NorseLaQuet said:

     Most languages (except VB and a few other POS languages) use 0 indexing. Think about it, if an index is an offset of the array, it follows that 0 is the first element because it has

     

    When did VB not use a zero based index?  Just curious.



  • @NorseLaQuet said:

    Please give meone good reasen why 1-indexing is a good idea.
     

      print goodReasons[0];

     

    damn it...



  • @NorseLaQuet said:

     Please give meone good reasen why 1-indexing is a good idea.
     

    Because that is how people think and therefore it is more natural?

    Why should the language make sense to the computer and not to the person instead?


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.