Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #14576 > unrolled thread
| Started by | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| First post | 2012-05-17 15:09 +0200 |
| Last post | 2012-05-24 09:42 -0700 |
| Articles | 20 on this page of 101 — 30 participants |
Back to article view | Back to comp.lang.java.programmer
Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-17 15:09 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-17 09:23 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-17 17:26 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Heikki Kallasjoki <fis+usenet@zem.fi> - 2012-05-17 16:19 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-17 19:57 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-05-17 18:33 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-17 23:25 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <lewbloch@gmail.com> - 2012-05-17 14:52 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-17 14:58 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-17 17:59 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Heikki Kallasjoki <fis+usenet@zem.fi> - 2012-05-17 22:13 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-18 01:18 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-17 21:32 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Noob <root@127.0.0.1> - 2012-05-18 17:08 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-19 20:53 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-19 21:19 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-19 18:47 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-20 17:55 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-19 20:18 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-19 20:21 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-19 20:52 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:27 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <noone@lewscanon.com> - 2012-05-19 14:48 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <noone@lewscanon.com> - 2012-05-19 15:20 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <noone@lewscanon.com> - 2012-05-19 15:35 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:25 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) bugbear <bugbear@trim_papermule.co.uk_trim> - 2012-05-21 17:12 +0100
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Heikki Kallasjoki <fis+usenet@zem.fi> - 2012-05-18 07:22 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <noone@lewscanon.com> - 2012-05-19 14:50 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:21 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:23 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-18 01:09 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:14 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 09:36 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-20 17:53 +0200
Re: names for parameters of ranges Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:30 -0400
Re: names for parameters of ranges Gene Wirchenko <genew@ocis.net> - 2012-05-20 20:48 -0700
Re: names for parameters of ranges (was: ...) Willem <willem@toad.stack.nl> - 2012-05-23 09:43 +0000
Re: names for parameters of ranges Willem <willem@toad.stack.nl> - 2012-05-23 11:07 +0000
Re: names for parameters of ranges Willem <willem@toad.stack.nl> - 2012-05-23 15:42 +0000
Re: names for parameters of ranges Willem <willem@toad.stack.nl> - 2012-05-23 11:11 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Heikki Kallasjoki <fis+usenet@zem.fi> - 2012-05-17 19:13 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Heikki Kallasjoki <fis+usenet@zem.fi> - 2012-05-17 19:19 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Jim Janney <jjanney@shell.xmission.com> - 2012-05-17 18:35 -0600
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-17 23:16 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:32 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 09:40 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-21 10:05 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 14:41 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:12 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Keith Thompson <kst-u@mib.org> - 2012-05-20 16:38 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <noone@lewscanon.com> - 2012-05-20 18:52 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Keith Thompson <kst-u@mib.org> - 2012-05-20 19:21 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) gazelle@shell.xmission.com (Kenny McCormack) - 2012-05-21 08:24 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Bill Leary" <Bill_Leary@msn.com> - 2012-05-23 14:34 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-05-20 21:46 -0600
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <noone@lewscanon.com> - 2012-05-21 00:04 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) gazelle@shell.xmission.com (Kenny McCormack) - 2012-05-21 08:25 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 09:46 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) jacob navia <jacob@spamsink.net> - 2012-05-17 18:54 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Mark Storkamp <mstorkamp@yahoo.com> - 2012-05-17 12:06 -0500
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) markspace <-@.> - 2012-05-17 10:11 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <lewbloch@gmail.com> - 2012-05-17 14:43 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) markspace <-@.> - 2012-05-17 16:13 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) markspace <-@.> - 2012-05-17 16:42 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Jan Burse <janburse@fastmail.fm> - 2012-05-18 02:27 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 15:06 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Marius" <sorry@nospamfor.me> - 2012-05-17 17:32 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-17 23:45 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Marius" <sorry@nospamfor.me> - 2012-05-17 22:16 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-18 00:47 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-24 14:11 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-24 14:17 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Roedy Green <see_website@mindprod.com.invalid> - 2012-05-18 02:57 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-18 05:26 -0500
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-18 08:08 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 14:46 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) rossum <rossum48@coldmail.com> - 2012-05-18 12:25 +0100
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Gene Wirchenko <genew@ocis.net> - 2012-05-18 10:46 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-19 21:01 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:33 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Patricia Shanahan <pats@acm.org> - 2012-05-20 16:30 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Gene Wirchenko <genew@ocis.net> - 2012-05-20 20:36 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Kaz Kylheku <kaz@kylheku.com> - 2012-05-21 04:28 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 09:55 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 09:49 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-21 10:08 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 10:45 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 11:13 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 11:19 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <lewbloch@gmail.com> - 2012-05-21 11:40 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Arne Vajhøj <arne@vajhoej.dk> - 2012-05-20 18:10 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-21 10:00 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-05-21 10:10 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) falk@rahul.net (Edward A. Falk) - 2012-05-23 05:40 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Jim Janney <jjanney@shell.xmission.com> - 2012-05-23 08:46 -0600
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> - 2012-05-24 14:03 +0200
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Lew <lewbloch@gmail.com> - 2012-05-24 09:56 -0700
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) falk@rahul.net (Edward A. Falk) - 2012-05-26 00:52 +0000
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_@charter.net> - 2012-05-25 21:16 -0400
Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2012-05-24 09:42 -0700
Page 1 of 6 [1] 2 3 4 5 6 Next page →
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-17 15:09 +0200 |
| Subject | Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) |
| Message-ID | <b3f1b$4fb4f87c$5419acc3$14079@cache60.multikabel.net> |
Hello,
My hypothesis that a human being cannot write 10 lines of code without
making a mistake has been confirmed by either oracle or google or both
depending on what you believe ;)
The lawsuit apperently mentions these 9 lines of code:
"
private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
if (fromIndex > toIndex)
throw new IllegalArgumentException("fromIndex(" + fromIndex +
") > toIndex(" + toIndex+")");
if (fromIndex < 0)
throw new ArrayIndexOutOfBoundsException(fromIndex);
if (toIndex > arrayLen)
throw new ArrayIndexOutOfBoundsException(toIndex);
}
"
There is at least 1 major bug in it:
toIndex could equal arrayLen which would still be out of bounds assuming
zero-index-based arrays.
So for example if the array length is 100, then toIndex is valid for range 0
to 99.
And therefore the exception should be raised for equalness to arrayLen as
well.
So the correct code should probably have been ">=" instead of just ">".
Except if some special outside code assumes that it's ok... I don't know
where this routine is being used... but by itself it would be flawed.
Also fromIndex could also still go out of range past arrayLen this is also
not checked.
So this code seems highly buggy and does somewhat prove that it was copied
?!
It's a bit unlikely that two programmers make the exact same dumb mistake !
;)
So the funny part is, the bugs in it kinda prove that it was copied ! ;)
Mimimimimimimmimimi :)
Bye,
Skybuck.
[toc] | [next] | [standalone]
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
|---|---|
| Date | 2012-05-17 09:23 -0400 |
| Message-ID | <jp2u4h$aoa$1@dont-email.me> |
| In reply to | #14576 |
On 5/17/2012 9:09 AM, Skybuck Flying wrote: > There is at least 1 major bug in it: > > toIndex could equal arrayLen which would still be out of bounds assuming > zero-index-based arrays. I believe toIndex in this case is being used in half-open notation, so toIndex is the first element not accessed. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-17 17:26 +0200 |
| Message-ID | <e69c4$4fb51b41$5419acc3$11300@cache100.multikabel.net> |
| In reply to | #14576 |
"Fred K" wrote in message
news:29308868.1994.1337265697084.JavaMail.geo-discussion-forums@pbcuc6...
On Thursday, May 17, 2012 6:09:23 AM UTC-7, Skybuck Flying wrote:
> Hello,
>
> My hypothesis that a human being cannot write 10 lines of code without
> making a mistake has been confirmed by either oracle or google or both
> depending on what you believe ;)
>
> The lawsuit apperently mentions these 9 lines of code:
>
> "
> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
> if (fromIndex > toIndex)
> throw new IllegalArgumentException("fromIndex(" + fromIndex +
> ") > toIndex(" + toIndex+")");
"
This is not C.
"
It's a curly brace language which the same kind of stupid c programming see
below.
> if (fromIndex < 0)
> throw new ArrayIndexOutOfBoundsException(fromIndex);
> if (toIndex > arrayLen)
> throw new ArrayIndexOutOfBoundsException(toIndex);
> }
> "
>
> There is at least 1 major bug in it:
>
> toIndex could equal arrayLen which would still be out of bounds assuming
> zero-index-based arrays.
>
> So for example if the array length is 100, then toIndex is valid for range
> 0
> to 99.
>
> And therefore the exception should be raised for equalness to arrayLen as
> well.
>
> So the correct code should probably have been ">=" instead of just ">".
>
> Except if some special outside code assumes that it's ok... I don't know
> where this routine is being used... but by itself it would be flawed.
>
> Also fromIndex could also still go out of range past arrayLen this is also
> not checked.
>
"
Actually it is checked by the combined actions of the first and third "if"
statements.
"
A very perverse way. The mission is to check if indexes are outside the
array "out of bounds".
Furthermore it makes no sense, copieing from high to low should be possible
as well, so it's obvious this code assumes that copieing from low to high is
the only possibility. A strange assumption to make, making this code much
less usuable and much less flexible in the case it needs to be adjusted to
accommodate for this new functionality as will often be the case with
software and changing requirements.
Furthermore it seems to be an "optimization". Instead of simple using 4
branches, the code tries to do it with 3.
Furthermore a dependency is added on the correctness of another branch.
Since the 3 branch is incorrect the first one is now incorrect as well
leading to two different possible bugs instead of just one.
bug1: toIndex can now be out of bounds.
bug2: fromIndex can now be out of bounds as well.
Example: 100 100
This code is a nice example oh how not to program.
Apperently only a skilled coder/debugger like me seems to be able to spot
the fallacies in this way too debug-complex code.
Lesson to be learned from this code:
Do not introduce dependencies like this.
> So this code seems highly buggy and does somewhat prove that it was copied
> ?!
>
> It's a bit unlikely that two programmers make the exact same dumb mistake
> !
> ;)
>
> So the funny part is, the bugs in it kinda prove that it was copied ! ;)
>
> Mimimimimimimmimimi :)
Bye,
Skybuck.
[toc] | [prev] | [next] | [standalone]
| From | Heikki Kallasjoki <fis+usenet@zem.fi> |
|---|---|
| Date | 2012-05-17 16:19 +0000 |
| Message-ID | <slrnjra97k.d62.fis@iris.zem.fi> |
| In reply to | #14578 |
On 2012-05-17, Skybuck Flying <Windows7IsOK@DreamPC2006.com> wrote:
>> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
>> if (fromIndex > toIndex)
>> throw new IllegalArgumentException("fromIndex(" + fromIndex +
>> ") > toIndex(" + toIndex+")");
>> if (fromIndex < 0)
>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>> if (toIndex > arrayLen)
>> throw new ArrayIndexOutOfBoundsException(toIndex);
>> }
> A very perverse way. The mission is to check if indexes are outside the
> array "out of bounds".
>
> Furthermore it makes no sense, copieing from high to low should be possible
Who said anything about copying?
I believe it is checking whether the range fromIndex, fromIndex+1, ...,
toIndex-1 -- i.e., a range given as the first index and one past the
last index, not an uncommon practice -- is within the array, in which
case it has no bugs. (toIndex may legally equal the length of the array
when the range extends to the last element, and requiring the range to
be specified "the right way around" is not especially perverse.)
--
Heikki Kallasjoki
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-17 19:57 +0200 |
| Message-ID | <84131$4fb54067$5419acc3$20839@cache90.multikabel.net> |
| In reply to | #14582 |
"Heikki Kallasjoki" wrote in message news:slrnjra97k.d62.fis@iris.zem.fi...
On 2012-05-17, Skybuck Flying <Windows7IsOK@DreamPC2006.com> wrote:
>> private static void rangeCheck(int arrayLen, int fromIndex, int toIndex)
>> {
>> if (fromIndex > toIndex)
>> throw new IllegalArgumentException("fromIndex(" + fromIndex +
>> ") > toIndex(" + toIndex+")");
>> if (fromIndex < 0)
>> throw new ArrayIndexOutOfBoundsException(fromIndex);
>> if (toIndex > arrayLen)
>> throw new ArrayIndexOutOfBoundsException(toIndex);
>> }
> A very perverse way. The mission is to check if indexes are outside the
> array "out of bounds".
>
> Furthermore it makes no sense, copieing from high to low should be
> possible
"
Who said anything about copying?
"
It seems likely this code is called right before the array is accessed to
try and prevent an access violation, instead it tries to throw a somewhat
nicer exception message to indicate a problem with array access.
(Reading/writing to an array can be considered "copieing").
"
I believe it is checking whether the range fromIndex, fromIndex+1, ...,
toIndex-1 -- i.e., a range given as the first index and one past the
last index, not an uncommon practice -- is within the array, in which
case it has no bugs. (toIndex may legally equal the length of the array
when the range extends to the last element, and requiring the range to
be specified "the right way around" is not especially perverse.)
"
It's simply not valid. Out of bounds has a very clear meaning in programming
practice. It's either within bounds or it's not. The bounds of a java array
are very clearly defined. Thus the only logical conclusion is that the code
is simply bugged.
Either in logic or in description. Either change the exception-description
or fix the code.
If this were some stack based structure then it would make sense that the
index could go one beyond the size. However it's not a stack, but an array.
The perversity is not with checking if "to" is beyond "from". The perversity
is the logical dependency of the "from" out of bounds check onto the "to"
out of bounds check.
Both indexes can be considered separate indexes and there a simply routine
which would check each index individually would be better/preferred.
However this routine seems to try and do multiple tasks all at once, which
is another bad coding practice.
Therefore advice:
1. Split routine up into two separate routines:
First routine to check if a single index is out of bounds.
Second routine to check if the indexes are in proper order.
Further more checking the indexes independently might even execute faster
because of instruction level parallelism, so this attempted optimization
might actually be counter productive, except for perhaps less instruction
decoding.
The call overhead of using multiple routines could be counter acted by
inlining features. I am not sure if java has "inlining" support.
Bye,
Skybuck.
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2012-05-17 18:33 +0000 |
| Message-ID | <jp3g9r$v22$1@speranza.aioe.org> |
| In reply to | #14588 |
In comp.lang.java.programmer Skybuck Flying <Windows7IsOK@dreampc2006.com> wrote: (snip) >>> if (fromIndex < 0) >>> throw new ArrayIndexOutOfBoundsException(fromIndex); >>> if (toIndex > arrayLen) >>> throw new ArrayIndexOutOfBoundsException(toIndex); (snip, someone else wrote) >> I believe it is checking whether the range fromIndex, fromIndex+1, ..., >> toIndex-1 -- i.e., a range given as the first index and one past the >> last index, not an uncommon practice -- is within the array, in which >> case it has no bugs. (toIndex may legally equal the length of the array >> when the range extends to the last element, and requiring the range to >> be specified "the right way around" is not especially perverse.) >> " > It's simply not valid. Out of bounds has a very clear meaning > in programming practice. It's either within bounds or it's not. But this isn't "programming" it is Java, and Java can do it however it wants to. > The bounds of a java array are very clearly defined. Thus the > only logical conclusion is that the code is simply bugged. > Either in logic or in description. Either change the > exception-description or fix the code. Look at the definition of the substring method in String class. It avoids a lot of -1 by the programmer to define it this way. (Along with consistently starting indexing at zero.) -- glen
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-17 23:25 +0200 |
| Message-ID | <4e980$4fb56cac$5419acc3$13190@cache60.multikabel.net> |
| In reply to | #14589 |
" "glen herrmannsfeldt" wrote in message news:jp3g9r$v22$1@speranza.aioe.org... In comp.lang.java.programmer Skybuck Flying <Windows7IsOK@dreampc2006.com> wrote: (snip) >>> if (fromIndex < 0) >>> throw new ArrayIndexOutOfBoundsException(fromIndex); >>> if (toIndex > arrayLen) >>> throw new ArrayIndexOutOfBoundsException(toIndex); (snip, someone else wrote) >> I believe it is checking whether the range fromIndex, fromIndex+1, ..., >> toIndex-1 -- i.e., a range given as the first index and one past the >> last index, not an uncommon practice -- is within the array, in which >> case it has no bugs. (toIndex may legally equal the length of the array >> when the range extends to the last element, and requiring the range to >> be specified "the right way around" is not especially perverse.) >> " > It's simply not valid. Out of bounds has a very clear meaning > in programming practice. It's either within bounds or it's not. But this isn't "programming" it is Java, and Java can do it however it wants to. > The bounds of a java array are very clearly defined. Thus the > only logical conclusion is that the code is simply bugged. > Either in logic or in description. Either change the > exception-description or fix the code. Look at the definition of the substring method in String class. It avoids a lot of -1 by the programmer to define it this way. (Along with consistently starting indexing at zero.) " Not really, Programmers of all languages must be able to communicate with each other through common language and concepts. 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. Any code deviating from the standard/coming meaning of range should clearly state so. Obviously if the routine was ment to check "range" then it's flawed. Obviously if the routine was ment to check "range-1" then it’s name should have been slightly different to state just that, example: checkRangeMinusOne or checkRangeInclusiveExclusive or CheckRangeExceptLast Fortunately for us the code is available, but this is not always the case in other programming languages like C where sometimes only headers are available. Nice way to sneak in bugs ! ;) Bye, Skybuck.
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-05-17 14:52 -0700 |
| Message-ID | <ee3eb2f8-85ec-4950-8abe-2086136b9649@googlegroups.com> |
| In reply to | #14594 |
Skybuck Flying wrote:
> Not really,
>
> Programmers of all languages must be able to communicate with each other
> through common language and concepts.
>
> One such concept is "range".
>
> It's pretty clearly defined:
>
> http://en.wikipedia.org/wiki/Range_(computer_programming)
That definition does not contradict what others have said.
For example, it clearly states that the range of an array in
zero-index languages is from the lower bound (zero) to
one less than the length of the array.
If the variables in the program you incorrectly deride
specified the range differently from that, you would be right,
but they don't, so you're wrong.
> Any computer language deviating from the standard/common meaning of range
> should clearly state so.
Java is not such a language.
> Any code deviating from the standard/coming meaning of range should clearly
> state so.
The code you cite does not so deviate.
> Obviously if the routine was ment to check "range" then it's flawed.
Obviously it is not. If you write a loop such as
for (int index = 0; index < TOP; ++index) { ... }
it is perfectly legal for TOP to equal the array length, as in the
code you excoriate. If you wish to check that "0" and "TOP" specify
a valid range, you'd call that routine with
rangeCheck( array.length, 0, TOP);
just like they say to, and it would check the range just as defined
in the Wikipedia article you cite.
Your logic is what's flawed.
I guess you aren't such a skilled "coder/debugger" as you claim.
> Obviously if the routine was ment to check "range-1" then it’s [sic]
> name should have been slightly different to state just that, example:
Obviously that is just your own idiosyncratic style despotism speaking.
>
> checkRangeMinusOne
>
> or
>
> checkRangeInclusiveExclusive
>
> or
>
> CheckRangeExceptLast
>
> Fortunately for us the code is available, but this is not always the case in
> other programming languages like C where sometimes only headers are
> available.
>
> Nice way to sneak in bugs ! ;)
You have shown no bugs.
You don't even cite how that routine is used, you only speculate
and rant based on your unfounded assumptions and reasoning.
--
Lew
[toc] | [prev] | [next] | [standalone]
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Date | 2012-05-17 14:58 -0700 |
| Message-ID | <Ewetr.11986$x11.9060@newsfe21.iad> |
| In reply to | #14594 |
On 5/17/12 2:25 PM, Skybuck Flying wrote: > But this isn't "programming" it is Java, and Java can do it however > it wants to. > >> The bounds of a java array are very clearly defined. Thus the >> only logical conclusion is that the code is simply bugged. >> Either in logic or in description. Either change the >> exception-description or fix the code. > > Look at the definition of the substring method in String class. > > It avoids a lot of -1 by the programmer to define it this way. > (Along with consistently starting indexing at zero.) > " > > Not really, > > Programmers of all languages must be able to communicate with each other > through common language and concepts. > > One such concept is "range". I read the method as saying "Verify this range is valid for this array length." and it is according to the algorithm used. It is a programming concept, open ended ranges are very frequent.
[toc] | [prev] | [next] | [standalone]
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
|---|---|
| Date | 2012-05-17 17:59 -0400 |
| Message-ID | <jp3sbr$s52$1@dont-email.me> |
| In reply to | #14594 |
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. That you spend so much time arguing that this interpretation is wrong indicates that you don't both to do much programming. Also, note that Wikipedia isn't necessarily correct. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
[toc] | [prev] | [next] | [standalone]
| From | Heikki Kallasjoki <fis+usenet@zem.fi> |
|---|---|
| Date | 2012-05-17 22:13 +0000 |
| Message-ID | <slrnjrau0n.f5o.fis@iris.zem.fi> |
| In reply to | #14600 |
On 2012-05-17, Joshua Cranmer <Pidgeot18@verizon.invalid> 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
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-18 01:18 +0200 |
| Message-ID | <ce693$4fb5871f$5419acc3$19177@cache80.multikabel.net> |
| In reply to | #14602 |
"Heikki Kallasjoki" wrote in message news:slrnjrau0n.f5o.fis@iris.zem.fi... On 2012-05-17, Joshua Cranmer <Pidgeot18@verizon.invalid> 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.) " There is no "rangeCheck" function for java.util.Arrays: http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html To me it appears as if rangeCheck is some low level operating system code or memory management code to try and prevent the os or applications from crashing or exploits from taking over the system. It would be interesting to know where this "rangeCheck" function is from. I would not be surprised that the functions you mentioned would be the cause of many bugs in java programs. Almost seems like a deliberate design to make java programs crash... perhaps a nice test for the "sand boxing" which after many years has proven to be a failure, google for java exploits ;) One of the reasons why java will not be installed onto my computers now and in the future. Seeing these functions only re-assures me of my decision to do so. Bye, Skybuck.
[toc] | [prev] | [next] | [standalone]
| From | Joshua Cranmer <Pidgeot18@verizon.invalid> |
|---|---|
| Date | 2012-05-17 21:32 -0400 |
| Message-ID | <jp48rq$6s8$1@dont-email.me> |
| In reply to | #14607 |
On 5/17/2012 7:18 PM, Skybuck Flying wrote: > There is no "rangeCheck" function for java.util.Arrays: > > http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html > > To me it appears as if rangeCheck is some low level operating system > code or memory management code to try and prevent the os or applications > from crashing or exploits from taking over the system. It's a private method in java.util.Arrays, which is why the API does not list it. If you actually read the code you'd posted, you would have realized that. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
[toc] | [prev] | [next] | [standalone]
| From | Noob <root@127.0.0.1> |
|---|---|
| Date | 2012-05-18 17:08 +0200 |
| Message-ID | <jp5olq$bl2$1@dont-email.me> |
| In reply to | #14611 |
Joshua Cranmer wrote: > It's a private method in java.util.Arrays, which is why the API does > not list it. If you actually read the code you'd posted, you would > have realized that. Dear Joshua, Sane people have kill-filed "Skybuck Flying" so long ago that they don't remember whether they used a computer or an abacus to set up the kill file. Regards.
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-19 20:53 +0200 |
| Message-ID | <da1ed$4fb7ec3d$5419acc3$7735@cache60.multikabel.net> |
| In reply to | #14619 |
"Noob" wrote in message news:jp5olq$bl2$1@dont-email.me... Joshua Cranmer wrote: > It's a private method in java.util.Arrays, which is why the API does > not list it. If you actually read the code you'd posted, you would > have realized that. " Dear Joshua, Sane people have kill-filed "Skybuck Flying" so long ago that they don't remember whether they used a computer or an abacus to set up the kill file. Regards. " More trash from: A noiseless patient Spider
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-19 21:19 +0200 |
| Message-ID | <aec98$4fb8435f$5419acc3$30928@cache70.multikabel.net> |
| In reply to | #14619 |
"Noob" wrote in message news:jp5olq$bl2$1@dont-email.me... Joshua Cranmer wrote: > It's a private method in java.util.Arrays, which is why the API does > not list it. If you actually read the code you'd posted, you would > have realized that. " Dear Joshua, Sane people have kill-filed "Skybuck Flying" so long ago that they don't remember whether they used a computer or an abacus to set up the kill file. Regards. " Can you please stop abusing my threads. I think you are Jamie, I already asked you to stay out of my threads. If you not Jamie, then I ask you as well, to stay out of my threads, because you are wasting my time. I come here to discuss technical matters and not personal or even legal matters for that matter. Bye, Skybuck.
[toc] | [prev] | [next] | [standalone]
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Date | 2012-05-19 18:47 -0700 |
| Message-ID | <Q2Ytr.22260$TC4.21494@newsfe14.iad> |
| In reply to | #14661 |
On 5/19/12 12:19 PM, Skybuck Flying wrote: > > > "Noob" wrote in message news:jp5olq$bl2$1@dont-email.me... > > Joshua Cranmer wrote: > >> It's a private method in java.util.Arrays, which is why the API does >> not list it. If you actually read the code you'd posted, you would >> have realized that. > > " > Dear Joshua, > > Sane people have kill-filed "Skybuck Flying" so long ago that > they don't remember whether they used a computer or an abacus > to set up the kill file. > > Regards. > " > > Can you please stop abusing my threads. > > I think you are Jamie, I already asked you to stay out of my threads. > > If you not Jamie, then I ask you as well, to stay out of my threads, > because you are wasting my time. > > I come here to discuss technical matters and not personal or even legal > matters for that matter. > > Bye, > Skybuck. Skybuck, seriously *you're* the one that abuses threads. Perhaps if you stopped and thought longer, you wouldn't need to reply to yourself multiple times. Also, when most of the community expresses how you've misinterpreted something, it might be a signal that you actually are wrong. I know, strange that might happen, but sometimes it does. Don't bother replying to this, I'm not interested in a troll fest.
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-20 17:55 +0200 |
| Message-ID | <618ba$4fb91406$5419acc3$29246@cache100.multikabel.net> |
| In reply to | #14664 |
"Daniel Pitts" wrote in message news:Q2Ytr.22260$TC4.21494@newsfe14.iad... On 5/19/12 12:19 PM, Skybuck Flying wrote: > > > "Noob" wrote in message news:jp5olq$bl2$1@dont-email.me... > > Joshua Cranmer wrote: > >> It's a private method in java.util.Arrays, which is why the API does >> not list it. If you actually read the code you'd posted, you would >> have realized that. > > " > Dear Joshua, > > Sane people have kill-filed "Skybuck Flying" so long ago that > they don't remember whether they used a computer or an abacus > to set up the kill file. > > Regards. > " > > Can you please stop abusing my threads. > > I think you are Jamie, I already asked you to stay out of my threads. > > If you not Jamie, then I ask you as well, to stay out of my threads, > because you are wasting my time. > > I come here to discuss technical matters and not personal or even legal > matters for that matter. > > Bye, > Skybuck. " Skybuck, seriously *you're* the one that abuses threads. Perhaps if you stopped and thought longer, you wouldn't need to reply to yourself multiple times. Also, when most of the community expresses how you've misinterpreted something, it might be a signal that you actually are wrong. I know, strange that might happen, but sometimes it does. Don't bother replying to this, I'm not interested in a troll fest. " We were having a nice discussion, no need to start asking people to kill file me. It was interesting/educational for everybody I think ! ;) =D It has shed some led on short comings with java and c++ and ranges for some ! ;) Bye, Skybuck.
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-19 20:18 +0200 |
| Message-ID | <34ebb$4fb7e404$5419acc3$23502@cache50.multikabel.net> |
| In reply to | #14611 |
"Joshua Cranmer" wrote in message news:jp48rq$6s8$1@dont-email.me... On 5/17/2012 7:18 PM, Skybuck Flying wrote: > There is no "rangeCheck" function for java.util.Arrays: > > http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html > > To me it appears as if rangeCheck is some low level operating system > code or memory management code to try and prevent the os or applications > from crashing or exploits from taking over the system. " It's a private method in java.util.Arrays, which is why the API does not list it. If you actually read the code you'd posted, you would have realized that. " Nonsense, this code could have come from anywhere. There is no proof that this came from any api at all. I have yet to see any proof from the court case that this is actually from java.util.Arrays. The only thing hinting that it might be a private method is the static keyword, well excuse me for not being a java expert ;) Bye, Skybuck.
[toc] | [prev] | [next] | [standalone]
| From | "Skybuck Flying" <Windows7IsOK@DreamPC2006.com> |
|---|---|
| Date | 2012-05-19 20:21 +0200 |
| Message-ID | <a8b11$4fb7e4b7$5419acc3$16651@cache80.multikabel.net> |
| In reply to | #14647 |
Anyway the court case seems to be about "copyrightable api". If this is actually a private method then I don't see how that's relevant... since it's not part of the actually published api ! ;) Bye, Skybuck.
[toc] | [prev] | [next] | [standalone]
Page 1 of 6 [1] 2 3 4 5 6 Next page →
Back to top | Article view | comp.lang.java.programmer
csiph-web