Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #20899 > unrolled thread

Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;)

Started by"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
First post2012-05-17 15:09 +0200
Last post2012-05-27 04:49 -0700
Articles 20 on this page of 97 — 31 participants

Back to article view | Back to comp.lang.c


Contents

  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 ;) Fred K <fred.l.kleinschmidt@gmail.com> - 2012-05-17 07:41 -0700
      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 ;) 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 ;) 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 ;) 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 ;) nick_keighley_nospam@hotmail.com - 2012-05-21 06:42 -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: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: names for parameters of ranges nick_keighley_nospam@hotmail.com - 2012-05-23 05:05 -0700
            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 ;) "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 ;) nick_keighley_nospam@hotmail.com - 2012-05-22 00:23 -0700
                        Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) "BartC" <bc@freeuk.com> - 2012-05-22 11:02 +0100
        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 ;) nick_keighley_nospam@hotmail.com - 2012-05-24 00:49 -0700
              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 ;) nick_keighley_nospam@hotmail.com - 2012-05-22 00:27 -0700
    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 ;) 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 ;) nick_keighley_nospam@hotmail.com - 2012-05-22 00:34 -0700
              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 ;) Gene Wirchenko <genew@ocis.net> - 2012-05-21 10:02 -0700
                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 ;) 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 ;) 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 ;) Nobody <nobody@nowhere.com> - 2012-05-26 17:19 +0100
    Re: Oracle/Google demonstrate human beings cannot write 10 lines of code without making a mistake ;) nick_keighley_nospam@hotmail.com - 2012-05-27 04:49 -0700

Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →


#21092

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-20 18:27 -0400
Message-ID<4fb96fbf$0$293$14726298@news.sunsite.dk>
In reply to#21034
On 5/19/2012 2:21 PM, Skybuck Flying wrote:
> 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 ! ;)

No.

The trial was about 3 things:
A) patent violation
B) copyright violations in some specific code
C) copyright violation due to using Java API

This code snippet was part of B.

C is what is generally considered most interesting.

Arne

[toc] | [prev] | [next] | [standalone]


#21091

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-20 18:25 -0400
Message-ID<4fb96f4d$0$293$14726298@news.sunsite.dk>
In reply to#21033
On 5/19/2012 2:18 PM, Skybuck Flying wrote:
> 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.

That has been clearly proven in court.

And the source for Arrays.java is available, so you can check
if you think someone lied in court.

> The only thing hinting that it might be a private method is the static
> keyword, well excuse me for not being a java expert ;)

SO you dot think the presence of the private keyword indicates that
it is private?

Interesting!

Arne

[toc] | [prev] | [next] | [standalone]


#21137

Frombugbear <bugbear@trim_papermule.co.uk_trim>
Date2012-05-21 17:12 +0100
Message-ID<D7CdnVF4t4Tx9CfSnZ2dnUVZ8jydnZ2d@brightview.co.uk>
In reply to#21033
Skybuck Flying wrote:

>
> The only thing hinting that it might be a private method is the static keyword, well excuse me for not being a java expert ;)

You might want to stop making a fool of
yourself by commenting in ignorance.

  BugBear

[toc] | [prev] | [next] | [standalone]


#20973

FromHeikki Kallasjoki <fis+usenet@zem.fi>
Date2012-05-18 07:22 +0000
Message-ID<slrnjrbu60.gee.fis@iris.zem.fi>
In reply to#20958
On 2012-05-17, Skybuck Flying <Windows7IsOK@DreamPC2006.com> wrote:
> 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.

AFAIK, it's originally from TimSort, the sorting algorithm used in Java
nowadays.  See
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/TimSort.java?view=co
-- rangeCheck is at the end of the file.  It's not low-level at all; the
sandboxing is enforced by the Java VM.  It's just used once to check the
arguments of sort(), before starting the actual work, presumably in
order to get more sensible-looking exceptions that it might otherwise
produce. 

> 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 

Strongly disagree.  I wouldn't be surprised if the number of places
where half-open intervals are used would outnumber the uses of fully
inclusive ranges, though a thorough survey is outside the scope of this
message.  I can only think of PHP range() and Perl "a..b" notation
offhand.  I'm sure more can be found; but then again, that applies also
to half-open ranges, for which C++ (STL), JavaScript, Python and Java
have already been mentioned.


-- 
Heikki Kallasjoki

[toc] | [prev] | [next] | [standalone]


#21089

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-20 18:21 -0400
Message-ID<4fb96e55$0$293$14726298@news.sunsite.dk>
In reply to#20958
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

That only shows public methods.

And the code snippet said private.

So ...

> 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.

Th JVM does that fine without this check.


> 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.

Maybe you should learn:
   * the difference between an app and an applet
   * the differnce between crash and throwing an exception

Arne

[toc] | [prev] | [next] | [standalone]


#21090

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-20 18:23 -0400
Message-ID<4fb96ede$0$293$14726298@news.sunsite.dk>
In reply to#20958
On 5/17/2012 7:18 PM, Skybuck Flying wrote:
> It would be interesting to know where this "rangeCheck" function is from.

http://www.theverge.com/2012/4/19/2961128/google-chief-java-architect-likely-i-copied-sun-code-in-android

explains that.

Arne

[toc] | [prev] | [next] | [standalone]


#20957

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-18 01:09 +0200
Message-ID<bd887$4fb5851a$5419acc3$11635@cache90.multikabel.net>
In reply to#20946

"Joshua Cranmer"  wrote in message news:jp3sbr$s52$1@dont-email.me...

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.
"

More reference material on this would be nice.

None the less this does not mean that STL is correct, it could be flawed 
just like standard library for C's gets.

"
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.
"

For such a simple concept as "range" to state that wikipedia is incorrect is 
a bit cheap/cheesy.

None the less programming was invented by mathematicians so let's see what 
they have to say about it:

"
Answer:
For a Function
The "range" is the set of all possible values of a function for the values 
of the variable.

Read more: 
http://wiki.answers.com/Q/What_is_the_definition_of_range_in_math#ixzz1vAehNwPN
"

The array can be considered the variable, the values of this variable can be 
considered the indexes.

The data elements can be considered the indirect values which are pointed 
towards by the indexes.

Therefore "all possible values" is the full range from 0 to 9 for an array 
of 10 elements starting with a zero based index.

Interestingly enough another website defines the range to be "9" (highest 
value - smallest value). Which seems to be a compounded variable/value.

However here array length is specified which is 10 and thus not a "range" in 
this sense. Thus length != range.

Finally your claims make me wonder if this is perhaps why "for each" and 
"for all" was invented because c++ programmers fok-up to much with the 
openness which you described ! ;)

That would be quite amuzing that you guys now need a special "for each" to 
iterate correctly ;)

So much for that lol ("programming skill") ;)

Bye,
  Skybuck.

[toc] | [prev] | [next] | [standalone]


#21087

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-20 18:14 -0400
Message-ID<4fb96cb9$0$283$14726298@news.sunsite.dk>
In reply to#20937
On 5/17/2012 5:25 PM, 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)
>
> 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.

It does!

You just chose not to read it!

> 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.

C function also has documentation.

And unlike you most C programmers will probably read it.

Arne

[toc] | [prev] | [next] | [standalone]


#21116

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-21 09:36 +0200
Message-ID<22b61$4fb9fc61$5419acc3$22636@cache1.tilbu1.nb.home.nl>
In reply to#21087

"Arne Vajhøj"  wrote in message 
news:4fb96cb9$0$283$14726298@news.sunsite.dk...

On 5/17/2012 5:25 PM, 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)
>
> 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.

"
It does!
"

No not really, not from that code snippet.

"
You just chose not to read it!
"

No, the only code available is what I posted.

> 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.

"
C function also has documentation.

And unlike you most C programmers will probably read it.

Arne
"

This code snippet came without any documentation.

If the body wasn't present then it would be unclear to what the range would 
be.

Only a java expert/experienced programmer might know this odd range 
behaviour.

Plenty of other programming language do not follow this odd range behaviour 
as well as general math.

Bye,
  Skybuck. 

[toc] | [prev] | [next] | [standalone]


#21130

Fromnick_keighley_nospam@hotmail.com
Date2012-05-21 06:42 -0700
Message-ID<742fc609-437d-49e9-a585-0d05ccf5a192@googlegroups.com>
In reply to#20937
On Thursday, May 17, 2012 10:25:08 PM UTC+1, Skybuck Flying wrote:
> "glen herrmannsfeldt"  wrote in message 
> news:jp3g9r$v22$1@speranza.aioe.org...
> In comp.lang.java.programmer Skybuck Flying <Windows7IsOK@dreampc2006.com> 

> >>>     if (fromIndex < 0)
> >>>         throw new ArrayIndexOutOfBoundsException(fromIndex);
> >>>     if (toIndex > arrayLen)
> >>>         throw new ArrayIndexOutOfBoundsException(toIndex);

> >> 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 not everyone expresses ranges the same way. The Java code you quote is quite consistent with, say, the C++ STL.

> But this isn't "programming" it is Java, and Java can do it however
> it wants to.

Java programming isn't programming?

<snip>

> Programmers of all languages must be able to communicate with each other 
> through common language and concepts.

why? languages vary. Try posting "but C does have macros!" on comp.lang.lisp. Or consider recent threads on = == := .EQ. etc.

<snip>

[toc] | [prev] | [next] | [standalone]


#21067

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-20 17:53 +0200
Message-ID<1bd38$4fb91376$5419acc3$14683@cache80.multikabel.net>
In reply to#20924

"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.
"

String might/could be an exception, but me not interested in strings so 
much.

"
It avoids a lot of -1 by the programmer to define it this way.
(Along with consistently starting indexing at zero.)
"

The -1 is what keep programs correct. It's the lack of -1 that will 
ultimately lead to bugs, confusion and problems ! ;) :)

Not to mention wrong ranges ! ;)

Learn to use -1 consistently and all will be fine ! ;) :) =D

Bye,
  Skybuck.

[toc] | [prev] | [next] | [standalone]


#21093 — Re: names for parameters of ranges

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-20 18:30 -0400
SubjectRe: names for parameters of ranges
Message-ID<4fb9706e$0$293$14726298@news.sunsite.dk>
In reply to#21067
On 5/20/2012 12:24 PM, Stefan Ram wrote:
> "Skybuck Flying"<Windows7IsOK@DreamPC2006.com>  writes:
>> But this isn't "programming" it is Java, and Java can do it however
>> it wants to.
>
>    Yes. But it is not only Java, it also is English used for
>    mnemonic identifiers. And in English, phrases like »from
>    index« and »to index« have a meaning.
>
>    So, if one would name a parameter »maximum« and then specify
>    this to mean the maximum plus 1, it would be a bad name.

bad name != bug

especially if it is documented.

Heikki posted the Java docs in another post:

/**
  * Checks that fromIndex and toIndex are in range, and throws an
  * appropriate exception if they aren't.
  *
  * @param arrayLen the length of the array
  * @param fromIndex the index of the first element of the range
  * @param toIndex the index after the last element of the range
  * @throws IllegalArgumentException if fromIndex > toIndex
  * @throws ArrayIndexOutOfBoundsException if fromIndex < 0
  *         or toIndex > arrayLen
  */

It is pretty clear how toIndex should be used even with
that name.

Arne

[toc] | [prev] | [next] | [standalone]


#21106 — Re: names for parameters of ranges

FromGene Wirchenko <genew@ocis.net>
Date2012-05-20 20:48 -0700
SubjectRe: names for parameters of ranges
Message-ID<9mejr7t9ai5kqcq0fa307bjku37kg3nf8g@4ax.com>
In reply to#21093
On Sun, 20 May 2012 18:30:05 -0400, Arne Vajhøj <arne@vajhoej.dk>
wrote:

>On 5/20/2012 12:24 PM, Stefan Ram wrote:
>> "Skybuck Flying"<Windows7IsOK@DreamPC2006.com>  writes:
>>> But this isn't "programming" it is Java, and Java can do it however
>>> it wants to.
>>
>>    Yes. But it is not only Java, it also is English used for
>>    mnemonic identifiers. And in English, phrases like »from
>>    index« and »to index« have a meaning.
>>
>>    So, if one would name a parameter »maximum« and then specify
>>    this to mean the maximum plus 1, it would be a bad name.
>
>bad name != bug
>
>especially if it is documented.

     Admitting to a mistake does not make it not a mistake.

[snip]

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#21228 — Re: names for parameters of ranges (was: ...)

FromWillem <willem@toad.stack.nl>
Date2012-05-23 09:43 +0000
SubjectRe: names for parameters of ranges (was: ...)
Message-ID<slrnjrpca8.17s1.willem@toad.stack.nl>
In reply to#21067
Stefan Ram wrote:
)   Yes. But it is not only Java, it also is English used for
)   mnemonic identifiers. And in English, phrases like ?from
)   index? and ?to index? have a meaning.
)
)   So, if one would name a parameter ?maximum? and then specify
)   this to mean the maximum plus 1, it would be a bad name.
)
)   For example, we can read:
)
)       ?The left and right edges of the rectangle are at x and x + width.
)       The top and bottom edges are at y and y + height.?
)
) http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#drawRect(int, int, int, int)
)
)   Now, let's take this ?width? to be 1, and x to be 3,
)   y = 5, height = 3, we have the following rectangle
)   drawn according to the documentation:
)
) 9
) 8  ##
) 7  ##
) 6  ##
) 5  ##
) 4
) 3
) 2
) 1
) 0123456789
)
)   When one looks at this rectangle, would one say that its
)   width was 1 and its height was 3? Yet this is the way the
)   parameters are named!

One would, if one were to define a 'line' to be centered on the pixel.
You seem to define it to be on the edge of the pixel.  Both are plausible.

Look at this, for example:
10
9 +---+---+
8 |   |   |  
7 |   |   |  
6 |   |   |  
5 +---+---+
4 |   |   |  
3 |   |   |  
2 |   |   |  
1 +---+---+
0
 0123456789

Is it four 4x4 rectangles that together form an 8x8 rectangle,
or is it four 5x5 rectangles that form a 9x9 rectangle?
The latter would be odd, given that 5+5=10 (and not 9).

And once you get into transforming coordinates, anti-aliasing
and whatnot, your definition falls flat on its face.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

[toc] | [prev] | [next] | [standalone]


#21232 — Re: names for parameters of ranges

FromWillem <willem@toad.stack.nl>
Date2012-05-23 11:07 +0000
SubjectRe: names for parameters of ranges
Message-ID<slrnjrph6t.2dqm.willem@toad.stack.nl>
In reply to#21228
Stefan Ram wrote:
) Willem <willem@toad.stack.nl> writes:
)>And once you get into transforming coordinates, anti-aliasing
)>and whatnot, your definition falls flat on its face.
)
)   I do not know what the wording ?your definition? above
)   refers to. So, maybe, you could give this definition and
)   then show how it ?falls flat on its face? when
)   ?transforming coordinates?.

Then you should read my post again.  Especially the bits you snipped,
and specifically the bit with the phrase 'you seem to define it ...'.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

[toc] | [prev] | [next] | [standalone]


#21241 — Re: names for parameters of ranges

FromWillem <willem@toad.stack.nl>
Date2012-05-23 15:42 +0000
SubjectRe: names for parameters of ranges
Message-ID<slrnjrq1b0.1a0l.willem@toad.stack.nl>
In reply to#21232
Stefan Ram wrote:
) Willem <willem@toad.stack.nl> writes:
)>Then you should read my post again.  Especially the bits you snipped,
)>and specifically the bit with the phrase 'you seem to define it ...'.
)
)   Ok, this was not a definition given by me, so the rest does not apply.

Obviously you're just here to "win" arguments instead of having an actual
discussion.  Grow up.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

[toc] | [prev] | [next] | [standalone]


#21233 — Re: names for parameters of ranges

FromWillem <willem@toad.stack.nl>
Date2012-05-23 11:11 +0000
SubjectRe: names for parameters of ranges
Message-ID<slrnjrphfh.2dqm.willem@toad.stack.nl>
In reply to#21228
Stefan Ram wrote:
) Willem <willem@toad.stack.nl> writes:
)>And once you get into transforming coordinates, anti-aliasing
)>and whatnot, your definition falls flat on its face.
)
)       ?An integer interval that has a finite lower or
)       upper endpoint always includes that endpoint.?
)
) http://en.wikipedia.org/wiki/Interval_(mathematics)#Integer_intervals

So?

Supose I build a straight fence on the edge of my field, with posts at 1
meter intervals.  The fence is 10 posts wide.
Now, I want to build a similar fence (with the same interval) on the edge
of my other field, which is twice as long.  How many posts should I use?

(Why is this relevant: In this example, I'm transforming the coordinates,
 scaling up by a factor of 2).


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

[toc] | [prev] | [next] | [standalone]


#21259 — Re: names for parameters of ranges

Fromnick_keighley_nospam@hotmail.com
Date2012-05-23 05:05 -0700
SubjectRe: names for parameters of ranges
Message-ID<ea47cc28-2d38-4ddf-9347-74098305a1d3@googlegroups.com>
In reply to#21228
On Wednesday, May 23, 2012 11:18:34 AM UTC+1, Stefan Ram wrote:
> Willem <willem@toad.stack.nl> writes:
> >And once you get into transforming coordinates, anti-aliasing
> >and whatnot, your definition falls flat on its face.
> 
>       »An integer interval that has a finite lower or
>       upper endpoint always includes that endpoint.«
> 
> http://en.wikipedia.org/wiki/Interval_(mathematics)#Integer_intervals

since the same web page describes various other alternatives, including the Java one, you are being disingenuous at best

[toc] | [prev] | [next] | [standalone]


#20926

FromHeikki Kallasjoki <fis+usenet@zem.fi>
Date2012-05-17 19:13 +0000
Message-ID<slrnjrajds.f35.fis@iris.zem.fi>
In reply to#20923
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);
>>> }
>
> 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.

No.  It seems likely rangeCheck(10, 4, 7) is testing whether indices 4,
5 and 6 (that is the *range* from 4, inclusive, to 7, exclusive) are
within the bounds of an array of length 10, which it does just fine.

> 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 

Yes, but it is not designed for testing whether fromIndex and toIndex
are within those bounds.  It is used to test whether fromIndex,
fromIndex+1, ..., toIndex-1 are, which it does.  In particular, the
element with index "toIndex" is not part of the range it's testing, so
it does not need to be inside the array bounds.

In other words, the range fromIndex=5, toIndex=10 denotes the elements
5, 6, 7, 8 and 9.  It does not include element 10.  rangeCheck(10, 5, 10)
is not supposed to throw an exception, nor does it do so.

(Would it be possible to also stop crossposting to all the unrelated
groups?)


-- 
Heikki Kallasjoki

[toc] | [prev] | [next] | [standalone]


#20936

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-17 23:16 +0200
Message-ID<ebdc3$4fb56a8c$5419acc3$10655@cache60.multikabel.net>
In reply to#20926

"Heikki Kallasjoki"  wrote in message news:slrnjrajds.f35.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);
>>> }
>
> 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.

"
No.  It seems likely rangeCheck(10, 4, 7) is testing whether indices 4,
5 and 6 (that is the *range* from 4, inclusive, to 7, exclusive) are
within the bounds of an array of length 10, which it does just fine.

> 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

Yes, but it is not designed for testing whether fromIndex and toIndex
are within those bounds.  It is used to test whether fromIndex,
fromIndex+1, ..., toIndex-1 are, which it does.  In particular, the
element with index "toIndex" is not part of the range it's testing, so
it does not need to be inside the array bounds.

In other words, the range fromIndex=5, toIndex=10 denotes the elements
5, 6, 7, 8 and 9.  It does not include element 10.  rangeCheck(10, 5, 10)
is not supposed to throw an exception, nor does it do so.

(Would it be possible to also stop crossposting to all the unrelated
groups?)
"

Now it's becoming a computer programming language issue.

What is the definition of "range".

You cannot simply redefine the meaning of "range". As you did by writing 
"inclusive" and then "exclusive" and flipping flopping whenever it suits 
you.

The programming language known as C probably introduced the "curly brace 
language".

Java is based on C and also uses the "curly brace language".

Since Java seems to be based of off C and is actually implemented in C it's 
safe to say that the word known as "range" in computer language follows the 
same meaning as it has in C.

Wikipedia is pretty clear about what "range" means in the programming 
language C:

http://en.wikipedia.org/wiki/Range_(computer_programming)

Range is always inclusive unless otherwise stated.

Therefore a programmer seeing a prototype of "rangeCheck" without actually 
seeing the body of the code should be safe to assume that range encompanses 
all of the indexes, being inclusive.

Thus calling rangeCheck( 10, 0, 10 ) would include index 10 to be checked 
for out of bounds.

In this case it would be out of bounds, yet no exception is raised, thus 
from any point of view the function is flawed.

Bye,
  Skybuck. 

[toc] | [prev] | [next] | [standalone]


Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →

Back to top | Article view | comp.lang.c


csiph-web