Path: csiph.com!usenet.pasdenom.info!goblin3!goblin.stu.neva.ru!newsfeed2.funet.fi!newsfeeds.funet.fi!feeder1.news.elisa.fi!uutiset.elisa.fi!7564ea0f!not-for-mail Newsgroups: alt.comp.lang.borland-delphi,comp.lang.c,comp.lang.java.programmer From: Heikki Kallasjoki Subject: Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) References: <29308868.1994.1337265697084.JavaMail.geo-discussion-forums@pbcuc6> <84131$4fb54067$5419acc3$20839@cache90.multikabel.net> <4e980$4fb56cac$5419acc3$13190@cache60.multikabel.net> Organization: nonexistent Followup-To: comp.lang.java.programmer User-Agent: slrn/pre1.0.0-18 (Linux) Message-ID: Lines: 28 Date: Thu, 17 May 2012 22:13:44 GMT NNTP-Posting-Host: 91.156.75.88 X-Complaints-To: newsmaster@saunalahti.com X-Trace: uutiset.elisa.fi 1337292824 91.156.75.88 (Fri, 18 May 2012 01:13:44 EEST) NNTP-Posting-Date: Fri, 18 May 2012 01:13:44 EEST Xref: csiph.com comp.lang.c:20948 comp.lang.java.programmer:14602 On 2012-05-17, Joshua Cranmer wrote: > On 5/17/2012 5:25 PM, Skybuck Flying wrote: >> One such concept is "range". >> >> It's pretty clearly defined: >> >> http://en.wikipedia.org/wiki/Range_(computer_programming) >> >> Any computer language deviating from the standard/common meaning of >> range should clearly state so. > > In 0-based array indexes, the standard interpretation of a range is the > half-open model: start <= value < end. Note in particular things like > the standard STL idioms, JavaScript slice, python's methods. And, most relevantly in this context, the standard methods in java.util.Arrays (binarySearch, copyOfRange, fill, sort), all of which accept ranges using the half-open "inclusive start, exclusive end" way. Most of them even have parameters called "fromIndex" and "toIndex", identically to rangeCheck. Surely it would be strange and unexpected to deviate from this "standard/common meaning" used by the system libraries. (Not to mention that the code in question, in its generated-documentation comments quoted elsethread, does clearly state what the arguments mean.) -- Heikki Kallasjoki