Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Zero-based numbering
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Origin === [[Martin Richards (computer scientist)|Martin Richards]], creator of the [[BCPL]] language (a precursor of [[C (programming language)|C]]), designed arrays initiating at 0 as the natural position to start accessing the array contents in the language, since the value of a [[pointer (computer programming)|pointer]] ''p'' used as an address accesses the position {{nowrap|''p'' + 0}} in memory.<ref>{{cite book |url=http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf |title=The BCPL Reference Manual |publisher=Massachusetts Institute of Technology |author=Martin Richards |year=1967 |page=11}}</ref><ref name="mikehoye">{{cite web |url=http://exple.tive.org/blarg/2013/10/22/ |title=Cita{{not a typo|tion Nee}}ded |access-date=28 January 2014 |author=Mike Hoye}}</ref> BCPL was first compiled for the [[IBM 7094]]; the language introduced no [[Run time (program lifecycle phase)|run-time]] [[indirection lookup]]s, so the indirection optimization provided by these arrays was done at compile time.<ref name="mikehoye"/> The optimization was nevertheless important.<ref name="mikehoye"/><ref>{{cite web |url=https://www.multicians.org/thvv/7094.html |title=The IBM 7094 and CTSS |date=1995 |access-date=28 January 2014 |author=Tom Van Vleck}}</ref> In 1982 [[Edsger W. Dijkstra]] in his pertinent note ''Why numbering should start at zero''<ref name="dijkstra"/> argued that arrays subscripts should start at zero as the latter being the most [[natural number]]. Discussing possible designs of array ranges by enclosing them in a chained inequality, combining sharp and standard inequalities to four possibilities, demonstrating that to his conviction zero-based arrays are best represented by non-overlapping index ranges, which start at zero, alluding to [[Interval (mathematics)#Definitions|open, half-open and closed intervals]] as with the real numbers. Dijkstra's criteria for preferring this convention are in detail that it represents empty sequences in a more natural way {{nowrap|(''a'' β€ ''i'' < ''a'' ?)}} than closed "intervals" ({{nowrap|''a'' β€ ''i'' β€ (''a'' β 1) ?}}), and that with half-open "intervals" of naturals, the length of a sub-sequence equals the upper minus the lower bound ({{nowrap|''a'' β€ ''i'' < ''b''}} gives {{nowrap|(''b'' β ''a'')}} possible values for ''i'', with ''a'', ''b'', ''i'' all integers).
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Zero-based numbering
(section)
Add topic