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 17 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 5 of 5 — ← Prev page 1 2 3 4 [5]


#21140

FromGene Wirchenko <genew@ocis.net>
Date2012-05-21 10:02 -0700
Message-ID<11tkr7p5jqadp7518f6uubdnaffiu5gs4m@4ax.com>
In reply to#21109
On Mon, 21 May 2012 04:28:57 +0000 (UTC), Kaz Kylheku
<kaz@kylheku.com> wrote:

>On 2012-05-21, Gene Wirchenko <genew@ocis.net> wrote:
>>      Like months in JavaScript dates.  They are numbered 0-11, even in
>> output.  It definitely holds the record with me for the stupidest bit
>> of language design I have ever seen.
>
>This might be deliberately compatible with the "tm_mon" field in the ISO C
>"struct tm" type.
>
>In its defence, it *is* apologetically called "broken down" time. :)

      "Yes, we know it is wrong, but we did it anyway."  Some defence.

>I may just repeat this mistake in the TXR language, because the impelmentation
>language C, and doing it differently means inventing another way of
>representing time, just for the heck of it, and then converting back and forth.

     No, for the sake of avoiding off-by-one errors.

     Whenever I have to deal with JavaScript date objects, I have to
put the adjustments in my code.  It gets very old, very fast.  Miss
one and bug.  Ease of use?  Pfft.

Sincerely,

Gene Wirchenko

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


#21120

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

"Gene Wirchenko"  wrote in message 
news:6tdjr75l3ak05u77v033nr0djibutbuccb@4ax.com...

On Sun, 20 May 2012 16:30:27 -0700, Patricia Shanahan <pats@acm.org>
wrote:

[snip]

>The rangeCheck method looks like a case of taking a block of code that
>would be very frequently repeated in a class and making it into a
>private method. Doing it in such a way that every caller had to put "-1"
>on one of the arguments would be very strange, and create an unnecessary
>risk of mistakes.

"
     Like months in JavaScript dates.  They are numbered 0-11, even in
output.  It definitely holds the record with me for the stupidest bit
of language design I have ever seen.

     An off-by-one error is a very common type of error.  Designing a
system in such a way as to make them more likely is really stupid.

Sincerely,

Gene Wirchenko
"

This makes sense if one wants to calculate with months for example:

A user gives 13 as the number of months that passed.

Not the question is how many years past and at what month are we ?

years: 13 / 12 = 1 year has passed
remaining months: 13 % 12 = 1 month has passed.

Correct answer is we are now in february, since january already elapsed.

Had it started at 1, your software would have been wrong believe it to be 
january=1.
While now january=0 and february=1

Bye,
  Skybuck.

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


#21117

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

"Patricia Shanahan"  wrote in message 
news:SI6dnZCFWN4L4yTSnZ2dnUVZ_qmdnZ2d@earthlink.com...

On 5/20/2012 3:33 PM, Arne Vajhøj wrote:
> On 5/19/2012 3:01 PM, Skybuck Flying wrote:
>> However in this case, assuming it was a mistake, both programmers would
>> have made the same mistake in exactly the same code, at exactly the same
>> position.
>>
>> Now that's a bit unlikely isn't it ?! ;)
>>
>> Mistakes with > or >= are usually random, and not at a fixed position.
>
> But given that the code was correct, then your argumentation is
> completely flawed.

"
Moreover, the choice of a semi-open range was forced by the
long-established public interfaces.

The rangeCheck method looks like a case of taking a block of code that
would be very frequently repeated in a class and making it into a
private method. Doing it in such a way that every caller had to put "-1"
on one of the arguments would be very strange, and create an unnecessary
risk of mistakes.

Patricia
"

Big nonsense, -1 is necessary to keep the range valid. By not applieing -1 
it introduces wrong ranges from a mathematical point of view, thus this will 
ultimately lead to buggy programs.

Bye,
  Skybuck.

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


#21132

FromJoshua Cranmer <Pidgeot18@verizon.invalid>
Date2012-05-21 10:08 -0400
Message-ID<jpdi9r$ore$2@dont-email.me>
In reply to#21117
On 5/21/2012 3:49 AM, Skybuck Flying wrote:
> Big nonsense, -1 is necessary to keep the range valid. By not applieing
> -1 it introduces wrong ranges from a mathematical point of view, thus
> this will ultimately lead to buggy programs.

I recall one of my programming books pointing out that just because it's 
correct in a mathematics sense doesn't mean it's correct in a 
programming sense.

-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. -- Donald E. Knuth

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


#21122

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-21 10:45 +0200
Message-ID<7b61f$4fba009f$5419acc3$26609@cache1.tilbu1.nb.home.nl>
In reply to#21095

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

On 5/19/2012 3:01 PM, Skybuck Flying wrote:
> However in this case, assuming it was a mistake, both programmers would
> have made the same mistake in exactly the same code, at exactly the same
> position.
>
> Now that's a bit unlikely isn't it ?! ;)
>
> Mistakes with > or >= are usually random, and not at a fixed position.

"
But given that the code was correct, then your argumentation is
completely flawed.

Arne
"

Depends on your points of view.

Anyway it also depends on how the code and documentation was constructed.

Usually programmers write code first and then document it. Sometimes there 
might also be a design plan.

But when it comes to APIs and function prototypes it's save to say that the 
documentation comes after the code has been written.

So one possible scenerio could have been:

1. The (flawed) code was written.

2. The (flawed) code was used, lot's of other code starts depending on it.

3. The bug was found, but instead of fixing it (and potentially breaking 
apps), the documentation was changed to "document the bug".

Another possible scenerio could have been that it was by design ;)

Bye,
  Skybuck.





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


#21125

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-21 11:13 +0200
Message-ID<e13b8$4fba12bb$5419acc3$22266@cache1.tilbu1.nb.home.nl>
In reply to#21122
It's time to dive into the versioning of java.

But let's start with something easy, something which will put this to rest:

It's time I copy & paste some documentation as well, illustrating my 
arguments:

http://docs.oracle.com/javase/1.3/docs/api/index.html

"
public class ArrayIndexOutOfBoundsException
extends IndexOutOfBoundsException

Thrown to indicate that an array has been accessed with an illegal index. 
The index is either negative or greater than or equal to the size of the 
array.
"

This clearly states that one may expect this particular exception to be 
raised for indexes which equal the size of the array.

Thus expecting a rangeCheck function which raises this exception to obey 
these rules makes sense, yet it does not.

Bye,
  Skybuck.

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


#21126

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-21 11:19 +0200
Message-ID<f2534$4fba12bb$5419acc3$22266@cache1.tilbu1.nb.home.nl>
In reply to#21122
Furthermore the code which is claimed to be from java.utils.Arrays has the 
following description for the documentation:

"
This class contains various methods for manipulating arrays (such as sorting 
and searching). It also contains a static factory that allows arrays to be 
viewed as lists.
The documentation for the sorting and searching methods contained in this 
class includes briefs description of the implementations. Such descriptions 
should be regarded as implementation notes, rather than parts of the 
specification. Implementors should feel free to substitute other algorithms, 
so long as the specification itself is adhered to. (For example, the 
algorithm used by sort(Object[]) does not have to be a mergesort, but it 
does have to be stable.)

"

It pretty clearly states that this documentation is a "description" of the 
implementation, and not a technical design.

Therefore it is possible that the implementation is flawed and the 
documentation simply documents this flaw.

Furthermore this java.utils.Arrays file doesn't seem to important.

Funny to see that all my hunches are being backed up by facts.

Bye,

  Skybuck.

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


#21085

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-20 18:10 -0400
Message-ID<4fb96bd5$0$283$14726298@news.sunsite.dk>
In reply to#20899
On 5/17/2012 9:09 AM, Skybuck Flying wrote:
> 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 ! ;)

The definition of a bug in code is when the code does not
do what it is supposed to do.

In this case the code does exactly what it is supposed to do
(according to the documentation).

So no bug.

May I suggest that you try reading the docs for a method
so you know what it is supposed to do before you claim that it
contains a bug.

Arne

t

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


#21121

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-21 10:00 +0200
Message-ID<6f188$4fb9fc61$5419acc3$22636@cache1.tilbu1.nb.home.nl>
In reply to#21085

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

On 5/17/2012 9:09 AM, Skybuck Flying wrote:
> 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 ! ;)

"
The definition of a bug in code is when the code does not
do what it is supposed to do.

In this case the code does exactly what it is supposed to do
(according to the documentation).

So no bug.

May I suggest that you try reading the docs for a method
so you know what it is supposed to do before you claim that it
contains a bug.

Arne
"

No not really, just because the documentation says that "red is now blue" 
doesn't make it alright.

There are certain concepts such as range which non-java programmers are used 
too.

If java wants to be taken seriously by me then it better take concepts like 
range seriously.

I don't take java seriously.

Bye,
  Skybuck. 

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


#21133

FromJoshua Cranmer <Pidgeot18@verizon.invalid>
Date2012-05-21 10:10 -0400
Message-ID<jpdidf$ore$3@dont-email.me>
In reply to#21121
On 5/21/2012 4:00 AM, Skybuck Flying wrote:
> No not really, just because the documentation says that "red is now
> blue" doesn't make it alright.
>
> There are certain concepts such as range which non-java programmers are
> used too.
>
> If java wants to be taken seriously by me then it better take concepts
> like range seriously.
>
> I don't take java seriously.

And now I expect you're going to whine that since floating point 
arithmetic isn't associative, any language that implements floating 
point can't be taken seriously. Despite this being an extremely 
long-standing, well-held convention.

-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. -- Donald E. Knuth

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


#21222

Fromfalk@rahul.net (Edward A. Falk)
Date2012-05-23 05:40 +0000
Message-ID<jpht7l$vnj$2@blue-new.rahul.net>
In reply to#20899
In article <b3f1b$4fb4f87c$5419acc3$14079@cache60.multikabel.net>,
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);
>}
>"

Executive summary:  If the indices here are used as [fromIndex toIndex) --
that is, inclusive-exclusive -- as is often the custom, *and* a
zero-length range is permitted, then this code is correct as written.

Plus, if this was a commonly-used code fragment, any error would have
turned up long ago.

Finally, the keyword "private" means that this function is unavailable
outside of the file that defines it.  There would be no reason to document
it.  There would also be no reason to hold it to any standard other than
that it perform the specific function for which it was intended.  Without
seeing the functions or methods that call it, there's really no true way
to know if it's buggy or not.

-- 
	-Ed Falk, falk@despams.r.us.com
	http://thespamdiaries.blogspot.com/

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


#21240

FromJim Janney <jjanney@shell.xmission.com>
Date2012-05-23 08:46 -0600
Message-ID<ydnpq9v2bvi.fsf@shell.xmission.com>
In reply to#21222
falk@rahul.net (Edward A. Falk) writes:

> In article <b3f1b$4fb4f87c$5419acc3$14079@cache60.multikabel.net>,
> 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);
>>}
>>"
>
> Executive summary:  If the indices here are used as [fromIndex toIndex) --
> that is, inclusive-exclusive -- as is often the custom, *and* a
> zero-length range is permitted, then this code is correct as written.
>
> Plus, if this was a commonly-used code fragment, any error would have
> turned up long ago.
>
> Finally, the keyword "private" means that this function is unavailable
> outside of the file that defines it.  There would be no reason to document
> it.  There would also be no reason to hold it to any standard other than
> that it perform the specific function for which it was intended.  Without
> seeing the functions or methods that call it, there's really no true way
> to know if it's buggy or not.

The complete code is available for inspection: it's distributed with
every copy of the JDK, and can also be found on the web at many places,
for example:

http://cr.openjdk.java.net/~martin/webrevs/openjdk7/timsort/src/share/classes/java/util/TimSort.java.html

And as has been pointed out before, the function *is* documented and the
implementation matches its contract exactly.

It's not a bug.  Period.

-- 
Jim Janney

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


#21273

From"Skybuck Flying" <Windows7IsOK@DreamPC2006.com>
Date2012-05-24 14:03 +0200
Message-ID<721bd$4fbe236e$5419acc3$390@cache1.tilbu1.nb.home.nl>
In reply to#21222

"Edward A. Falk"  wrote in message news:jpht7l$vnj$2@blue-new.rahul.net...

In article <b3f1b$4fb4f87c$5419acc3$14079@cache60.multikabel.net>,
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);
>}
>"

"
Executive summary:  If the indices here are used as [fromIndex toIndex) --
that is, inclusive-exclusive -- as is often the custom, *and* a
zero-length range is permitted, then this code is correct as written.

Plus, if this was a commonly-used code fragment, any error would have
turned up long ago.

Finally, the keyword "private" means that this function is unavailable
outside of the file that defines it.  There would be no reason to document
it.  There would also be no reason to hold it to any standard other than
that it perform the specific function for which it was intended.  Without
seeing the functions or methods that call it, there's really no true way
to know if it's buggy or not.
"

Just out of curiosity, if private already means it's private, then what does 
the static keyword mean ?

I guess it means the same as a class method in Delphi, which means it's 
defined only once and all classes share it ?!?

This might have to do with "virtual method tables" which java might be using 
?!? In this case a virtual method entry would be missing to save memory ???

Bye,
  Skybuck.

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


#21343

Fromfalk@rahul.net (Edward A. Falk)
Date2012-05-26 00:52 +0000
Message-ID<jpp9h7$2rg$1@blue-new.rahul.net>
In reply to#21273
In article <721bd$4fbe236e$5419acc3$390@cache1.tilbu1.nb.home.nl>,
Skybuck Flying <Windows7IsOK@DreamPC2006.com> wrote:
>
>Just out of curiosity, if private already means it's private, then what does 
>the static keyword mean ?

Yeah, now we're totally off-topic.

In Java, "static" isn't about scope, it's used to differentiate a
global class-wide variable or function from one that's bound to
a specific instance of the class.

-- 
	-Ed Falk, falk@despams.r.us.com
	http://thespamdiaries.blogspot.com/

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


#21344

FromJamie <jamie_ka1lpa_not_valid_after_ka1lpa_@charter.net>
Date2012-05-25 21:16 -0400
Message-ID<z0Wvr.1203$Bn.984@newsfe12.iad>
In reply to#21343
Edward A. Falk wrote:
> In article <721bd$4fbe236e$5419acc3$390@cache1.tilbu1.nb.home.nl>,
> Skybuck Flying <Windows7IsOK@DreamPC2006.com> wrote:
> 
>>Just out of curiosity, if private already means it's private, then what does 
>>the static keyword mean ?
> 
> 
> Yeah, now we're totally off-topic.
> 
> In Java, "static" isn't about scope, it's used to differentiate a
> global class-wide variable or function from one that's bound to
> a specific instance of the class.
> 

  And how is that different?

  I think people forget the true nature of the word "STATIC".

Jamie

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


#21369

FromNobody <nobody@nowhere.com>
Date2012-05-26 17:19 +0100
Message-ID<pan.2012.05.26.16.19.44.617000@nowhere.com>
In reply to#21344
On Fri, 25 May 2012 21:16:21 -0400, Jamie wrote:

>> In Java, "static" isn't about scope, it's used to differentiate a
>> global class-wide variable or function from one that's bound to
>> a specific instance of the class.
> 
>   And how is that different?

In Java, classes are objects (instances of the java.lang.Class class), so
class members aren't actually any more "static" than instance members.

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


#21410

Fromnick_keighley_nospam@hotmail.com
Date2012-05-27 04:49 -0700
Message-ID<a167040d-3eb6-4453-9a34-e1aac768f9cf@googlegroups.com>
In reply to#20899
On Thursday, May 17, 2012 2:09:23 PM UTC+1, Skybuck Flying wrote:

> 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 ;)

whilst I disagree with your conclusions about the error I'm grateful toyou for bringing this lawsuit to my attention.I've obviously being living in a cave for a while.

[toc] | [prev] | [standalone]


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

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


csiph-web