Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: why the array index has to start at 0??

by ikegami (Pope)
on Jun 23, 2009 at 15:41 UTC ( #774066=note: print w/ replies, xml ) Need Help??

in reply to why the array index has to start at 0??

In N bits, an integer can represent 2^N indexes starting at zero. If you start at index 1, you'll only be able to access 2^N-1 indexes. Using 1-based indexes therefore requires indexes twice as big and requires more code to support the same array sizes. This was not a luxury that could be afforded.

This may not be the case anymore, but you can't ignore how it's been done for ages, and there are many other good reasons as you've seen throughout this thread.

Comment on Re: why the array index has to start at 0??

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://774066]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2015-11-26 08:21 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls