Arrays/indexes should start at 1 to be more intuitive

Arrays/indexes should start at 1 to be more intuitive
>are you fricking moronic? All you have to do is subtract one, it's not hard
Even if it's not hard, there's no benefit to starting at 0
>because it represents how computers work you fricking moron
Computers work however we design them, numbers are arbitrary symbols that we choose.
>But if syntaxes become easier to understand it won't make me feel superior anymore! What about all the time I spent memorizing unintuitive languages?
Not my problem.

Shopping Cart Returner Shirt $21.68

Black Rifle Cuck Company, Conservative Humor Shirt $21.68

Shopping Cart Returner Shirt $21.68

  1. 2 years ago
    Anonymous

    >>But if syntaxes become easier to understand it won't make me feel superior anymore! What about all the time I spent memorizing unintuitive languages?
    no one says that, you made it up

    >Computers work however we design them
    yes, and we have designed them to work this way, i dont see your point

    >there's no benefit to starting at 0
    if you want the compiler to change your 1s into 0s then sure, but 0-indexing is faster

    • 2 years ago
      groomiess

      >0-indexing is faster
      it's not any slower: O(1) access

      • 2 years ago
        Anonymous

        Big O notation doesn't refer to the actual real time something takes to execute.

    • 2 years ago
      Anonymous

      >we have designed them to work this way
      computers doesn't even know what 0 or 5 means moron. Again: numbers are arbitrary symbols that we choose.
      >compiler to change your 1s into 0s
      No need to, numbers are arbitrary symbols that we choose. If we say it starts at 1 then that's it.

      • 2 years ago
        Anonymous

        >No need to, numbers are arbitrary symbols that we choose. If we say it starts at 1 then that's it.
        You are fricking moronic. Index * data type length is an offset from the memory address the array begins at. 0 index means no offset. With 1 being first you either waste memory because the first space is useless or the computer has to subtract 1 from your index making it slower.
        It's made that way because it's the fastest way. How dumb are you, you Black person?

        • 2 years ago
          Anonymous

          That's how it works once compiled, not when it's human readable syntax moron.

        • 2 years ago
          Anonymous

          >Index * data type length is an offset from the memory address the array begins at.
          No it's not, it's an offset from an arbitrary address. The index can start at whatever number you want. It doesn't have to be at the beginning of the array. It can be before or after or in the middle of the array.

          >With 1 being first you either waste memory because the first space is useless or the computer has to subtract 1 from your index making it slower.
          It doesn't have to subtract 1 because that's a constant. It happens at compile time so nothing is slower.

          • 2 years ago
            Anonymous

            > it's an offset from an arbitrary address

            > It doesn't have to subtract 1 because that's a constant. It happens at compile time so nothing is slower.

          • 2 years ago
            Anonymous

            >It can be before or after or in the middle of the array.
            see

            Ok, look moron, it starts with 0 to be consistant with the offset, aka if you have a pointer to the first element of some array and you want to get the first(0th) element you offset the pointer 0 bytes. To get the nth, you offset n*sizeof(element) bytes. If you start with 1 you either: A) lose consistency with offsets, which will cause many more off-by-one errors, and an extra cpu cycle or two(which if you were a developer when they were designing these things was a HUGE deal), or B) you point to before the start of the array, but now you have a pointer to something completely different, which may even be garbage, that you have to KNOW is actually an array 1*sizeof(element) bytes later in memory. Besides to change this you'd need to overturn decades of software architecture.
            > But what if languages just translated from 1-based to 0-based when compiling/interpreting.
            Such languages exist(Lua, Fortran, Julia), use them and tell me how 'intuitive' it is, dumbass.

          • 2 years ago
            Anonymous

            >It doesn't have to subtract 1 because that's a constant. It happens at compile time so nothing is slower.
            What the frick is wrong with you? What if the index is calculated based on external data? Like some json field you get from wherever? How do you compile that if you don't know what the index is? Frick, Black person, even arr[rand(1,10)] makes not compile time constant.
            Are you a helloworlder? It's so easy to think of a case where you just don't know the index beforehand.

          • 2 years ago
            Anonymous

            OP knows what he's talking about, his fizzbuzzes are next level

          • 2 years ago
            Anonymous

            You are moronic

    • 2 years ago
      Anonymous

      >and we have designed them to work this way
      No we didn't. It's simply a carry-over from 80 years ago when "computers" were hard wired logic ciruits. It makes no sense on modern hardware.

  2. 2 years ago
    Anonymous

    Indices should start at 0
    >why?
    cuz Stone Cold said so.

  3. 2 years ago
    Anonymous

    >Even if it's not hard, there's no benefit to starting at 0
    Yes there is. Almost every CPU in existence has a bunch of instructions acting based on zero (or not).

    • 2 years ago
      Anonymous

      see

      >we have designed them to work this way
      computers doesn't even know what 0 or 5 means moron. Again: numbers are arbitrary symbols that we choose.
      >compiler to change your 1s into 0s
      No need to, numbers are arbitrary symbols that we choose. If we say it starts at 1 then that's it.

      moron. Computers have no understanding of "0", they have instructions that trigger when certain logic gates output below a voltage-threshold.

      • 2 years ago
        Anonymous

        Programming Language creators/maintainers and CPU manufacturers are not the same. Go ahead and build your language for your own CPU that has BNO and BO instructions moron.

        • 2 years ago
          Anonymous

          >Programming Language creators/maintainers and CPU manufacturers are not the same.
          Thanks for proving my point even more. Programming syntax is not the same as CPU design. It can be changed arbitrarily with no effect on the CPU.

  4. 2 years ago
    Anonymous

    Ok, look moron, it starts with 0 to be consistant with the offset, aka if you have a pointer to the first element of some array and you want to get the first(0th) element you offset the pointer 0 bytes. To get the nth, you offset n*sizeof(element) bytes. If you start with 1 you either: A) lose consistency with offsets, which will cause many more off-by-one errors, and an extra cpu cycle or two(which if you were a developer when they were designing these things was a HUGE deal), or B) you point to before the start of the array, but now you have a pointer to something completely different, which may even be garbage, that you have to KNOW is actually an array 1*sizeof(element) bytes later in memory. Besides to change this you'd need to overturn decades of software architecture.
    > But what if languages just translated from 1-based to 0-based when compiling/interpreting.
    Such languages exist(Lua, Fortran, Julia), use them and tell me how 'intuitive' it is, dumbass.

    • 2 years ago
      Anonymous

      >Such languages exist
      and they are more intuitive regarding enumeration of Arrays/indexes, mathematica is probably one of the most intuitive languages overall. Thanks for proving my point.

      • 2 years ago
        Anonymous

        If you think this proves your point you are beyond saving

    • 2 years ago
      Anonymous

      >Computers work however we design them, numbers are arbitrary symbols that we choose.
      how bout you read the entire OP next time before writing a triggered sperg rant

    • 2 years ago
      Anonymous

      >B) you point to before the start of the array, but now you have a pointer to something completely different, which may even be garbage, that you have to KNOW is actually an array 1*sizeof(element) bytes later in memory.

      >It can be before or after or in the middle of the array.
      see [...]

      >see
      Yes and this does not cause any problem for anyone.

  5. 2 years ago
    Anonymous

    Yeah it's just by convention, like current flow in electronics

  6. 2 years ago
    Anonymous

    https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

    • 2 years ago
      Anonymous

      >That is ugly
      wow, good argument.

      The reason arrays start on 0 is because in an untyped language (such as C) there's no other way to represent anything at runtime besides making them pointers and offsets. An array then can't encode its own element type or length, which means that it becomes necessary to treat the array itself as being equal to its first element as far as pointers go. From this also follows that arrays can't have access-time bounds checking; zero-indexed arrays cause buffer overflows.

      none of that matters when choosing syntax dummy. It might suprise you, but the shit you write on your screen isn't actually what the computer "reads". In fact, computers can't read at all.

  7. 2 years ago
    Anonymous

    The reason arrays start on 0 is because in an untyped language (such as C) there's no other way to represent anything at runtime besides making them pointers and offsets. An array then can't encode its own element type or length, which means that it becomes necessary to treat the array itself as being equal to its first element as far as pointers go. From this also follows that arrays can't have access-time bounds checking; zero-indexed arrays cause buffer overflows.

    • 2 years ago
      Anonymous

      > untyped language (such as C)
      You either have never written any basic program in C or you don't know what untyped means.

      > there's no other way to represent anything at runtime besides making them pointers and offsets
      In C arrays and pointers are not the same, all array has to do with a pointer is that it implicitly converts to it.

      > An array then can't encode its own element type or length
      It's simply not true, arrays in C don't encode its size and you mast be a massive moron to think that arrays don't encode the type when even pointers do it.

      > zero-indexed arrays cause buffer overflows
      That's just you being moronic, I've never had that problem.

      • 2 years ago
        Anonymous

        I did typo it should be:
        It's simply not true, arrays in C encode its size and you must be a massive moron to think that arrays don't encode the type when even pointers do it.

      • 2 years ago
        Anonymous

        >You either have never written any basic program in C or you don't know what untyped means
        >it implicitly converts to it
        See?
        Memory in C is untyped at runtime. The type system only exists in the compiler. Implicitly, everything is raw bytes.

        • 2 years ago
          Anonymous

          You're moving the goalpost.

          If untyped meant what you've described then Java, C#, Rust, Go, Haskell would also be untyped languages.

      • 2 years ago
        Anonymous

        Cniles think C has a real type system. Sad!

  8. 2 years ago
    Anonymous

    >Arrays/indexes should start at 1 to be more intuitive
    That only tells me that you don't understand what an array index is. An array index is just an offset from the first element.

    • 2 years ago
      Anonymous

      >literally doesn't know what / means
      lmao

  9. 2 years ago
    Anonymous

    old languages used to start arrays at 1
    it becomes a nightmare when you have to manage memory manually since memory is based around offsets
    that means you'll constantly hit off-by-one errors

    • 2 years ago
      Anonymous

      memory management and whatever symbols you type into the editor is not related moron.

  10. 2 years ago
    Anonymous

    Well, it depends on language concept I guess.
    At least in C and C++ relies on pointer arithmetic
    So for instance if I have:
    int foo[7];
    then
    - foo itself is a pointer to array, and also points to the first element as well (i.e. foo[0])
    - and foo+1 will calculate position of the next element (i.e. foo + sizeof(int) or simply foo[1])
    - caveat is that there is no foo[7], it is out of bounds

    No one is forbidding you to write wrapper stuff for that, i.e.
    int friendlyAt(int * arr, size_t size, size_t index)
    {
    // some safety check here with case of 0 and index > size
    return arr[index -1];
    }

  11. 2 years ago
    Anonymous

    Does the day start at 1AM?
    Does the hour start at minute 1?
    How would that even work?

    1-start is a fricking shit-show and and is perpetuated by people who don't understand ranges.

    • 2 years ago
      Anonymous

      >Does the day start at 1AM?
      No, because time is not a list of discreet entities you moron, and that's why we made clocks read 0:15 or whatever. Lists however DO start with number 1 in everything except some programming languages, those programming languages should be changed.
      Thanks for proving my point.

  12. 2 years ago
    Anonymous

    lua indexes start at 1
    lua is a literal BR language for low IQ shitskins
    therefore arrays starting at 1 is for low IQ shitskins

    • 2 years ago
      Anonymous

      that's just a convention
      Lua can use arbitrary indices
      > a = {}
      for i=-5, 5 do
      a[i] = i
      end
      > a[0]
      0

      • 2 years ago
        Anonymous

        >Lua can use arbitrary indices
        NTA but what the hell, why would anyone think this is a good idea? that's even worse than just starting at 1, how do you tell what any index means? what if i decide to start it at 5 because "hurr durr numbers are arbitrary symbols we choose"

        • 2 years ago
          Anonymous

          >why would anyone think this is a good idea?
          it can be useful in some math-related algos
          >what if i decide to start it at 5
          your program won't be compatible with any Lua library due to convention
          Julia allows arbitrary indices as well but also gives ways to work with them without raising issues

  13. 2 years ago
    Anonymous

    And say you're converting a three dimensional data model and packing it into 1 dimension. If you're using 1-start, the math is fricked.

    No one who proposes 1-start has ever actually dealt with real data problems and the only combinatorial problem they're familiar with is counting is on their fingers.

    • 2 years ago
      Anonymous

      These are all issues of offsets, ie. problems that only crop up when you're deaing with turing state machines eg. memory management. This isn't actual math and if you somehow thought this "revelation* would've made you look less moronic you're wrong

  14. 2 years ago
    Anonymous

    this is a non-issue
    if you're spending any brainpower on the question of 0index or 1index you're probably like a first year CS student

    all these fricking worthless surface level arguments
    language fight
    editor fight
    trivial syntax differences
    WHO CARES
    GO DO SOMETHING BETTER WITH YOUR TIME

  15. 2 years ago
    Anonymous

    I think if you actually used a 1-index language instead of a 0-index you'd change your tune. 0-index let's the computer put arrays in its terms while 1-index puts arrays in human terms, which is detrimental to making pretty solutions

  16. 2 years ago
    Anonymous

    >there's no benefit to starting at 0
    stopped reading there

  17. 2 years ago
    Anonymous

    Garbage take Rajeesh

  18. 2 years ago
    Anonymous

    >Computers work however we design them, numbers are arbitrary symbols that we choose.
    yeah bro, the guys who designed all this should have just decided to make it a bit slower and added a bit more complexity and made it a bit less intuitive just so your IQfy posting ass could have an easier time counting indices. all the people doing pointer arithmetic and crap can just go screw off because op doesn't like subtracting 1 when accessing his crappy webshit todo list array. what a homosexual

  19. 2 years ago
    Anonymous

    $ echo tongue my anus Black folk
    $ !:0 !:4 !:1-3

  20. 2 years ago
    Anonymous

    based
    fortran and matlab both start array indexing at 1, same as a mathematician does

  21. 2 years ago
    Anonymous

    Terry Davis died for your sins. Repent.

  22. 2 years ago
    Anonymous

    speaking as a llvm maintainer, op is beyond saving. spend some time learning how computers work and why 0 is such a magic number before you spew your nonsense. if arrays started at 1 it would all be kinds of fricked up

    • 2 years ago
      Anonymous

      >speaking as a llvm maintainer,
      Are you really? LLVM has a Fortran compiler and it starts arrays at 1.

      >op is beyond saving. spend some time learning how computers work and why 0 is such a magic number before you spew your nonsense. if arrays started at 1 it would all be kinds of fricked up
      You do not know how computers work.

      https://github.com/llvm/llvm-project/blob/main/flang/docs/FortranForCProgrammers.md
      >Arrays are not types in Fortran. Being an array is a property of an object or function, not of a type. Unlike C, one cannot have an array of arrays or an array of pointers, although can can have an array of a derived type that has arrays or pointers as components. Arrays are multidimensional, and the number of dimensions is called the rank of the array. In storage, arrays are stored such that the last subscript has the largest stride in memory, e.g. A(1,1) is followed by A(2,1), not A(1,2). And yes, the default lower bound on each dimension is 1, not 0.
      >And yes, the default lower bound on each dimension is 1, not 0.

      • 2 years ago
        Anonymous

        >use array with no index
        >it gives me the first element
        >want to access second element
        >requires an offset of 1 relative to the first element
        Makes sense to me. OP is a homosexual.

    • 2 years ago
      Anonymous

      >spend some time learning how computers work
      Computers work however we design them

      Starting at 0 is more convenient mathematically.
      Starting at 1 is more intuitive if the most complicated math you ever do on indices is incrementing/decrementing them, sure.
      It quickly loses its edge in intuition once you have to add or subtract any offset bigger than 1, especially any variable offset.

      numbers are arbitrary symbols that we choose

      • 2 years ago
        Anonymous

        >numbers are arbitrary symbols that we choose
        Nice stonerism. But there is nothing arbitrary about the additive and multiplicative identities.

        • 2 years ago
          Anonymous

          additive and multiplicative properties work how we define them

          • 2 years ago
            Anonymous

            If they worked any other way, it would be inconvenient.
            We don't define convenience. It's an emergent property of other things we define.

          • 2 years ago
            Anonymous

            you know what's convenient? 1-based indexing

            Their definition wasn't chosen randomly. Deconstructionism is a modern invention; the number system pre-dates the axiomatic construction of them. None of it was arbitrary, it all follows from the way the human mind works and the way the physical and biological reality works.

            you know how the human mind works? counting beginning at 1

          • 2 years ago
            Anonymous

            >you know what's convenient? 1-based indexing
            wrong
            see:

            Starting at 0 is more convenient mathematically.
            Starting at 1 is more intuitive if the most complicated math you ever do on indices is incrementing/decrementing them, sure.
            It quickly loses its edge in intuition once you have to add or subtract any offset bigger than 1, especially any variable offset.

          • 2 years ago
            Anonymous

            In order for counting to work, the numbering system must be the conventional one. You already conceded that if conventional mathematics were used, then the identities are significant beyond their name/symbol. You're just going in circles and you've conceded both points in doing so. If the conventional construction of mathematics is relevant and the identities are important in the conventional construction of mathematics, then 1 and 0 matter.

          • 2 years ago
            Anonymous

            Their definition wasn't chosen randomly. Deconstructionism is a modern invention; the number system pre-dates the axiomatic construction of them. None of it was arbitrary, it all follows from the way the human mind works and the way the physical and biological reality works.

      • 2 years ago
        Anonymous

        math isn’t arbitrary, you mong

        your high levek language can be all fricked up but if you try to work with addressing, moving memory and stuff it’ll quickly become apparent to your monkey brain why 0 is superior

        • 2 years ago
          Anonymous

          >try to work with addressing, moving memory and stuff
          Computers work however we design them
          they should have been designed for 1 instead of 0

        • 2 years ago
          Anonymous

          >addressing, moving memory and stuff
          All of these are arbitrary themselves.
          Memory could have been associative instead of serial at a hardware level

    • 2 years ago
      Anonymous

      >maintainer
      You mean you've updated a typo in their readme once. Anyone who uses this for credibility is a certified larper

  23. 2 years ago
    Anonymous

    Starting at 0 is more convenient mathematically.
    Starting at 1 is more intuitive if the most complicated math you ever do on indices is incrementing/decrementing them, sure.
    It quickly loses its edge in intuition once you have to add or subtract any offset bigger than 1, especially any variable offset.

    • 2 years ago
      Anonymous

      >Offset of 1 to access the current element is intuitive
      moron detected

  24. 2 years ago
    Anonymous

    The reason we use 0 is because integers can be signed or unsigned.
    Signed means going from -((bits^2)/2) to ((bits^2)/2). So, negative numbers to positive numbers.
    Unsigned means going from 0 to (bits^2). These are typical numbers you see, assuming base 10.
    While there is no particular reason for arrays and indexes to not start from 1, assuming we're not using a signed integer to index, there is also no real reason to not start from 0. Thus, in most languages, this has stayed the tradition.

  25. 2 years ago
    Anonymous

    0 isn't real.
    You can't mathematically prove that it exist without some sort of baseless assumption.

    • 2 years ago
      Anonymous

      and you can't mathematically prove you're not a homosexual

    • 2 years ago
      Anonymous

      you can't mathematically prove anything at all ever without some sort of baseless assumption
      and if you can then your standard of proof is inevitably self-contradictory
      https://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems

  26. 2 years ago
    Anonymous

    Fun fact! In any kind of math where indexes are used, either the only thing that matters is the order, in which case indexes could start at 0.5 without making things harder to understand, *or* if the indexes do matter, it's usually more intuitive if they start at zero. For instance, modular arithmetic, or the DFT matrix.

  27. 2 years ago
    Anonymous

    Numbers are an abstraction of reality. There is no base 10. Reality itself is irreducibly base 2.

  28. 2 years ago
    Anonymous

    Just use a real language and don't sweat the small stuff.
    Option Base 0
    Option Base 1

  29. 2 years ago
    Anonymous

    >Computers work however we design them, numbers are arbitrary symbols that we choose.
    if I stored a number in 8 bytes, it can only access 256 elements in an array, but if you started the index with 1, you would only be able to access 255 bytes, so one byte would be unused, and it's impossible to make a chip with 255 bytes because to access the memory, you need an interface, and that interface needs to request that memory using electric signals. and the signal would be binary, so even if it's possible to make a chip with 255 bytes, it would technically be possible to access 256 bytes due to the number of wires (in binary), you can either have 8 bits (256) or 7 bits (128). So maybe the CPU could pretend like there is a chip with 255 elements, and if you tried to access index 0, give a cpu fault, but when you do this, why can't you just use a 0 index array, and just ignore the 0 index? what benefits does giving a fault on 0 give, what if you want to disable this feature for production? why not disable this feature by default and only enable it for debugging?
    Lua is fine though but it's best used in the hands of a C programmer who wants scripts.

Your email address will not be published. Required fields are marked *