Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"I may be synthetic, but I'm not stupid" -- the artificial person, from _Aliens_


devel / comp.lang.fortran / “Why do arrays start at 0?"

SubjectAuthor
* “Why do arrays start at 0?"Lynn McGuire
+* Re: “Why do arrays start at 0?"Gary Scott
|+* Re: “Why do arrays start at 0?"Mr Flibble
||`* Re: “Why do arrays start at 0?"d thiebaud
|| +- Re: “Why do arrays start at 0?"gah4
|| +- Re: “Why do arrays start at 0?"Robin Vowels
|| `* Re: “Why do arrays start at 0?"Keith Thompson
||  `- Re: “Why do arrays start at 0?"Mr Flibble
|+- Re: “Why do arrays start at 0?"gah4
|+- Re: Re: “Why do arrays start at 0?"Scott Lurndal
|`- Re: ?Why do arrays start at 0?"Charlie Roberts
+* Re: “Why do arrays start at 0?"Louis Krupp
|`* Re: ?Why do arrays start at 0?"Charlie Roberts
| +- Re: “Why do arrays start at 0?"Thomas Koenig
| `* Re: “Why do arrays start at 0?"Ron Shepard
|  `* Re: “Why do arrays start at 0?"Thomas Koenig
|   `- Re: “Why do arrays start at 0?"gah4
+- Re: “Why do arrays start at 0?"Mr Flibble
+* Re: “Why do arrays start at 0?"Robin Vowels
|`* Re: “Why do arrays start at 0?"fiz...@gmail.com
| +* Re: “Why do arrays start at 0?"gah4
| |`* Re: “Why do arrays start at 0?"Thomas Koenig
| | `* Re: “Why do arrays start at 0?"gah4
| |  `* Re: “Why do arrays start at 0?"Thomas Koenig
| |   +* Re: “Why do arrays start at 0?"gah4
| |   |+- Re: “Why do arrays start at 0?"Thomas Koenig
| |   |`* Re: “Why do arrays start at 0?"Lynn McGuire
| |   | +* Re: “Why do arrays start at 0?"Thomas Koenig
| |   | |`- Re: “Why do arrays start at 0?"gah4
| |   | +* Re: “Why do arrays start at 0?"gah4
| |   | |`- Re: “Why do arrays start at 0?"Robin Vowels
| |   | `- Re: “Why do arrays start at 0?"Robin Vowels
| |   `* Re: “Why do arrays start at 0?"Ron Shepard
| |    +* Re: “Why do arrays start at 0?"Robin Vowels
| |    |`* Re: “Why do arrays start at 0?"Ron Shepard
| |    | `- Re: “Why do arrays start at 0?"Robin Vowels
| |    `- Re: “Why do arrays start at 0?"gah4
| `- Re: “Why do arrays start at 0?"Robin Vowels
+* Re: “Why do arrays start at 0?"Thomas Koenig
|`* Re: “Why do arrays start at 0?"d thiebaud
| +- Re: “Why do arrays start at 0?"FortranFan
| `- Re: “Why do arrays start at 0?"Thomas Koenig
+* Re: “Why do arrays start at 0?"Fred. Zwarts
|`* Re: “Why do arrays start at 0?"Lynn McGuire
| +* Re: “Why do arrays start at 0?"Thomas Koenig
| |+* Re: “Why do arrays start at 0?"John
| ||`- Re: “Why do arrays start at 0?"Robin Vowels
| |`* Re: “Why do arrays start at 0?"Lynn McGuire
| | +* Re: “Why do arrays start at 0?"Keith Thompson
| | |`- Re: “Why do arrays start at 0?"gah4
| | +* Re: “Why do arrays start at 0?"Thomas Koenig
| | |`- Re: “Why do arrays start at 0?"David Brown
| | `- Re: “Why do arrays start at 0?"Paavo Helde
| `* Re: “Why do arrays start at 0?"Fred. Zwarts
|  `- Re: “Why do arrays start at 0?"Thomas Koenig
+* Re: “Why do arrays start at 0?"Bonita Montero
|+- Re: “Why do arrays start at 0?"gah4
|`- Re: “Why do arrays start at 0?"Robin Vowels
`* Re: ???Why do arrays start at 0?"Juha Nieminen
 `- Re: ???Why do arrays start at 0?"gah4

Pages:123
“Why do arrays start at 0?"

<tebblf$2gpm$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2728&group=comp.lang.fortran#2728

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: lynnmcguire5@gmail.com (Lynn McGuire)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: “Why_do_arrays_start_at_0?"
Date: Fri, 26 Aug 2022 15:49:51 -0500
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <tebblf$2gpm$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 26 Aug 2022 20:49:51 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="d0595f06812cfef2222e5a009c859d41";
logging-data="82742"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pL0PdBlGBdbiu1AHJkVk4"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.2.0
Cancel-Lock: sha1:Ahqin+N7Gz+R348Bb5OlQ4VhdBk=
Content-Language: en-US
 by: Lynn McGuire - Fri, 26 Aug 2022 20:49 UTC

“Why do arrays start at 0?"
https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/

"It's not the reason you think. No, it's not that reason either.”

My Fortran starts at one. My C++ starts at zero. This has made my life
hell.

Lynn

Re: “Why do arrays start at 0?"

<tebfiv$2rs6$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2729&group=comp.lang.fortran#2729

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: garylscott@sbcglobal.net (Gary Scott)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Fri, 26 Aug 2022 16:56:47 -0500
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <tebfiv$2rs6$1@dont-email.me>
References: <tebblf$2gpm$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 26 Aug 2022 21:56:47 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9625a60244547231c4f61caac0eecb5e";
logging-data="94086"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+RJQeFnirXOrYSkr+A0UnQdMakJDA1nzk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
Cancel-Lock: sha1:EkSWJeJttPSgE01ILFycxH1Wo5E=
Content-Language: en-US
In-Reply-To: <tebblf$2gpm$1@dont-email.me>
 by: Gary Scott - Fri, 26 Aug 2022 21:56 UTC

On 8/26/2022 3:49 PM, Lynn McGuire wrote:
> “Why do arrays start at 0?"
>    https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>
> "It's not the reason you think. No, it's not that reason either.”
>
> My Fortran starts at one.  My C++ starts at zero.  This has made my life
> hell.
>
> Lynn
>
Fortran was there first...and got it right...you can change Fortran to
start at other index values for many cases.

Re: “Why do arrays start at 0?"

<pvbOK.866404$ntj.801728@fx15.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2730&group=comp.lang.fortran#2730

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
Subject: Re: “Why do arrays start at 0?"
Content-Language: en-US
Newsgroups: comp.lang.fortran,comp.lang.c++
References: <tebblf$2gpm$1@dont-email.me>
From: lkrupp@invalid.pssw.com.invalid (Louis Krupp)
In-Reply-To: <tebblf$2gpm$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 24
Message-ID: <pvbOK.866404$ntj.801728@fx15.iad>
X-Complaints-To: abuse(at)newshosting.com
NNTP-Posting-Date: Fri, 26 Aug 2022 22:08:21 UTC
Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com
Date: Fri, 26 Aug 2022 16:08:20 -0600
X-Received-Bytes: 1665
 by: Louis Krupp - Fri, 26 Aug 2022 22:08 UTC

On 8/26/2022 2:49 PM, Lynn McGuire wrote:
> “Why do arrays start at 0?"
> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>
> "It's not the reason you think. No, it's not that reason either.”
>
> My Fortran starts at one.  My C++ starts at zero.  This has made my
> life hell.
>

Here's a crude outline of a solution:

If you want a C++ array index to start at 1, make the array one element
bigger than necessary, and start indexing at 1, just like in Fortran.
Element 0 will be unused.

If you want a C++ array to map exactly to a Fortran array, but with an
index starting at 1, wrap the C++ array in a class and overload the
subscripting operator(s) to subtract 1 from the index.

Neither of these approaches seems elegant, but one of them should be
less hellish than the other.

Louis

Re: “Why do arrays start at 0?"

<20220827004445.00006a85@reddwarf.jmc.corp>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2731&group=comp.lang.fortran#2731

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx10.ams4.POSTED!not-for-mail
From: flibble@reddwarf.jmc.corp (Mr Flibble)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Message-ID: <20220827004445.00006a85@reddwarf.jmc.corp>
References: <tebblf$2gpm$1@dont-email.me>
Organization: Jupiter Mining Corporation
X-Newsreader: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Lines: 15
X-Complaints-To: abuse@eweka.nl
NNTP-Posting-Date: Fri, 26 Aug 2022 23:44:46 UTC
Date: Sat, 27 Aug 2022 00:44:45 +0100
X-Received-Bytes: 1204
 by: Mr Flibble - Fri, 26 Aug 2022 23:44 UTC

On Fri, 26 Aug 2022 15:49:51 -0500
Lynn McGuire <lynnmcguire5@gmail.com> wrote:

> “Why do arrays start at 0?"
> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>
> "It's not the reason you think. No, it's not that reason either.”
>
> My Fortran starts at one. My C++ starts at zero. This has made my
> life hell.

Fortran is retarded.

/Flibble

Re: “Why do arrays start at 0?"

<20220827004602.000075b1@reddwarf.jmc.corp>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2732&group=comp.lang.fortran#2732

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx10.ams4.POSTED!not-for-mail
From: flibble@reddwarf.jmc.corp (Mr Flibble)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Message-ID: <20220827004602.000075b1@reddwarf.jmc.corp>
References: <tebblf$2gpm$1@dont-email.me>
<tebfiv$2rs6$1@dont-email.me>
Organization: Jupiter Mining Corporation
X-Newsreader: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Lines: 24
X-Complaints-To: abuse@eweka.nl
NNTP-Posting-Date: Fri, 26 Aug 2022 23:46:02 UTC
Date: Sat, 27 Aug 2022 00:46:02 +0100
X-Received-Bytes: 1464
 by: Mr Flibble - Fri, 26 Aug 2022 23:46 UTC

On Fri, 26 Aug 2022 16:56:47 -0500
Gary Scott <garylscott@sbcglobal.net> wrote:

> On 8/26/2022 3:49 PM, Lynn McGuire wrote:
> > “Why do arrays start at 0?"
> >    https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
> >
> > "It's not the reason you think. No, it's not that reason either.”
> >
> > My Fortran starts at one.  My C++ starts at zero.  This has made my
> > life hell.
> >
> > Lynn
> >
> Fortran was there first...and got it right...you can change Fortran
> to start at other index values for many cases.

Being first doesn't make you correct. Fortran is retarded.

/Flibble

Re: “Why do arrays start at 0?"

<aa70a158-60c6-499c-869b-32fedfbc3f13n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2733&group=comp.lang.fortran#2733

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:1b01:b0:343:582f:3e07 with SMTP id bb1-20020a05622a1b0100b00343582f3e07mr1926877qtb.578.1661563446452;
Fri, 26 Aug 2022 18:24:06 -0700 (PDT)
X-Received: by 2002:a81:8a87:0:b0:333:a706:2734 with SMTP id
a129-20020a818a87000000b00333a7062734mr2200871ywg.431.1661563446158; Fri, 26
Aug 2022 18:24:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Fri, 26 Aug 2022 18:24:05 -0700 (PDT)
In-Reply-To: <tebfiv$2rs6$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:d84a:d558:2f42:3a78;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:d84a:d558:2f42:3a78
References: <tebblf$2gpm$1@dont-email.me> <tebfiv$2rs6$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aa70a158-60c6-499c-869b-32fedfbc3f13n@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 27 Aug 2022 01:24:06 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 9
 by: gah4 - Sat, 27 Aug 2022 01:24 UTC

On Friday, August 26, 2022 at 2:56:51 PM UTC-7, Gary Scott wrote:

(snip)
> Fortran was there first...and got it right...you can change Fortran to
> start at other index values for many cases.

ALGOL 60 has the [lower:upper] form, presumably back to 1960.

I have, at least a few times, converted programs from one to the other,
and yes it is amazingly easy to get wrong.

Re: “Why do arrays start at 0?"

<tebvj6$1chn$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2734&group=comp.lang.fortran#2734

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!Ojo9tLwCkFeEtRnxG8QQ3g.user.46.165.242.75.POSTED!not-for-mail
From: thiebauddick2@aol.com (d thiebaud)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Fri, 26 Aug 2022 22:29:58 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tebvj6$1chn$1@gioia.aioe.org>
References: <tebblf$2gpm$1@dont-email.me> <tebfiv$2rs6$1@dont-email.me>
<20220827004602.000075b1@reddwarf.jmc.corp>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="45623"; posting-host="Ojo9tLwCkFeEtRnxG8QQ3g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: d thiebaud - Sat, 27 Aug 2022 02:29 UTC

On 8/26/22 19:46, Mr Flibble wrote:
> On Fri, 26 Aug 2022 16:56:47 -0500
> Gary Scott <garylscott@sbcglobal.net> wrote:
>
>> On 8/26/2022 3:49 PM, Lynn McGuire wrote:
>>> “Why do arrays start at 0?"
>>>    https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>>>
>>> "It's not the reason you think. No, it's not that reason either.”
>>>
>>> My Fortran starts at one.  My C++ starts at zero.  This has made my
>>> life hell.
>>>
>>> Lynn
>>>
>> Fortran was there first...and got it right...you can change Fortran
>> to start at other index values for many cases.
>
> Being first doesn't make you correct. Fortran is retarded.
>
> /Flibble
>
A reasonable language would let you specify the lower index. Fortran
and C are both retarded.

Re: “Why do arrays start at 0?"

<4bd508ef-9a1d-40b6-b4a1-5906d9f4339cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2735&group=comp.lang.fortran#2735

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:60a:b0:344:5843:aac0 with SMTP id z10-20020a05622a060a00b003445843aac0mr2026593qta.459.1661567686719;
Fri, 26 Aug 2022 19:34:46 -0700 (PDT)
X-Received: by 2002:a25:320b:0:b0:693:8371:4836 with SMTP id
y11-20020a25320b000000b0069383714836mr2260969yby.313.1661567686528; Fri, 26
Aug 2022 19:34:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!1.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Fri, 26 Aug 2022 19:34:46 -0700 (PDT)
In-Reply-To: <tebvj6$1chn$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:d84a:d558:2f42:3a78;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:d84a:d558:2f42:3a78
References: <tebblf$2gpm$1@dont-email.me> <tebfiv$2rs6$1@dont-email.me>
<20220827004602.000075b1@reddwarf.jmc.corp> <tebvj6$1chn$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4bd508ef-9a1d-40b6-b4a1-5906d9f4339cn@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 27 Aug 2022 02:34:46 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 12
 by: gah4 - Sat, 27 Aug 2022 02:34 UTC

On Friday, August 26, 2022 at 7:30:05 PM UTC-7, d thiebaud wrote:

(snip)

> A reasonable language would let you specify the lower index. Fortran
> and C are both retarded.

Since it hasn't been mentioned yet, note the complication with
Fortran of subroutine arguments. Sometimes the dummy array
has origin 1, even when the actual argument doesn't. Sometimes.

Not that there is an easy answer, but it is a very confusing part
of Fortran arrays.

Re: “Why do arrays start at 0?"

<2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2736&group=comp.lang.fortran#2736

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ad4:5ba5:0:b0:496:fb2e:e213 with SMTP id 5-20020ad45ba5000000b00496fb2ee213mr2207038qvq.102.1661571095316;
Fri, 26 Aug 2022 20:31:35 -0700 (PDT)
X-Received: by 2002:a81:f47:0:b0:31f:434b:5ee with SMTP id 68-20020a810f47000000b0031f434b05eemr2562704ywp.383.1661571095077;
Fri, 26 Aug 2022 20:31:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Fri, 26 Aug 2022 20:31:34 -0700 (PDT)
In-Reply-To: <tebblf$2gpm$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=202.67.103.232; posting-account=S_MdrwoAAAD7T2pxG2e393dk6y0tc0Le
NNTP-Posting-Host: 202.67.103.232
References: <tebblf$2gpm$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: robin.vowels@gmail.com (Robin Vowels)
Injection-Date: Sat, 27 Aug 2022 03:31:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 15
 by: Robin Vowels - Sat, 27 Aug 2022 03:31 UTC

On Saturday, August 27, 2022 at 6:49:55 AM UTC+10, Lynn McGuire wrote:
> “Why do arrays start at 0?"
> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>
> "It's not the reason you think. No, it's not that reason either.”
>
> My Fortran starts at one. My C++ starts at zero. This has made my life
> hell.
..
FORTRAN followed centuries-old mathematical convention.
FORTRAN started at 1 for subscripts.
It's now been the default, since lower bounds were introduced.

PL/I has always allowed lower bounds other than 1,
the default being 1.

Re: “Why do arrays start at 0?"

<622e34c3-5229-441e-be54-3ac7a0811311n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2737&group=comp.lang.fortran#2737

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:2387:b0:496:c9db:82b0 with SMTP id fw7-20020a056214238700b00496c9db82b0mr2154234qvb.111.1661571264981;
Fri, 26 Aug 2022 20:34:24 -0700 (PDT)
X-Received: by 2002:a25:8a85:0:b0:671:715e:a1b0 with SMTP id
h5-20020a258a85000000b00671715ea1b0mr2181785ybl.98.1661571264730; Fri, 26 Aug
2022 20:34:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Fri, 26 Aug 2022 20:34:24 -0700 (PDT)
In-Reply-To: <tebvj6$1chn$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=202.67.103.232; posting-account=S_MdrwoAAAD7T2pxG2e393dk6y0tc0Le
NNTP-Posting-Host: 202.67.103.232
References: <tebblf$2gpm$1@dont-email.me> <tebfiv$2rs6$1@dont-email.me>
<20220827004602.000075b1@reddwarf.jmc.corp> <tebvj6$1chn$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <622e34c3-5229-441e-be54-3ac7a0811311n@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: robin.vowels@gmail.com (Robin Vowels)
Injection-Date: Sat, 27 Aug 2022 03:34:24 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1436
 by: Robin Vowels - Sat, 27 Aug 2022 03:34 UTC

On Saturday, August 27, 2022 at 12:30:05 PM UTC+10, d thiebaud wrote:

> A reasonable language would let you specify the lower index. Fortran
> and C are both retarded.
..
Fortran allowes the lower bound to be specified.

Re: “Why do arrays start at 0?"

<87h71yjmya.fsf@nosuchdomain.example.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2738&group=comp.lang.fortran#2738

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Fri, 26 Aug 2022 22:05:17 -0700
Organization: None to speak of
Lines: 31
Message-ID: <87h71yjmya.fsf@nosuchdomain.example.com>
References: <tebblf$2gpm$1@dont-email.me> <tebfiv$2rs6$1@dont-email.me>
<20220827004602.000075b1@reddwarf.jmc.corp>
<tebvj6$1chn$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader01.eternal-september.org; posting-host="aa2518ddd0ae0c244a7ee482cab325df";
logging-data="249374"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yA5W/E3q3kBf+wxesnfuh"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:QIw3xARSEol3h06Ve65kP4CX/o0=
sha1:qzCRtAkXcxhHJ9YUxJRMWLJwMU8=
 by: Keith Thompson - Sat, 27 Aug 2022 05:05 UTC

d thiebaud <thiebauddick2@aol.com> writes:
> On 8/26/22 19:46, Mr Flibble wrote:
>> On Fri, 26 Aug 2022 16:56:47 -0500
>> Gary Scott <garylscott@sbcglobal.net> wrote:
>>
>>> On 8/26/2022 3:49 PM, Lynn McGuire wrote:
>>>> “Why do arrays start at 0?"
>>>>    https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>>>>
>>>> "It's not the reason you think. No, it's not that reason either.”
>>>>
>>>> My Fortran starts at one.  My C++ starts at zero.  This has made my
>>>> life hell.
>>>>
>>>> Lynn
>>>>
>>> Fortran was there first...and got it right...you can change Fortran
>>> to start at other index values for many cases.
>> Being first doesn't make you correct. Fortran is retarded.
>> /Flibble
>>
> A reasonable language would let you specify the lower index. Fortran
> and C are both retarded.

"Mr Flibble" is a troll, and I'm sure he's aware that "retarded" is an
offensive word. Are you?

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: “Why do arrays start at 0?"

<tecb60$5sh$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2739&group=comp.lang.fortran#2739

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Sat, 27 Aug 2022 05:47:44 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tecb60$5sh$1@newsreader4.netcologne.de>
References: <tebblf$2gpm$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 27 Aug 2022 05:47:44 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:4e56:0:7285:c2ff:fe6c:992d";
logging-data="6033"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 27 Aug 2022 05:47 UTC

Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
> “Why do arrays start at 0?"
> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>
> "It's not the reason you think. No, it's not that reason either.”
>
> My Fortran starts at one. My C++ starts at zero. This has made my life
> hell.

If you want to declare your Fortran arrays to start at zero, just
declare them with a lower bound of zero, like

real, dimension(0:n-1) :: a

Re: “Why do arrays start at 0?"

<8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2740&group=comp.lang.fortran#2740

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:622a:1986:b0:343:225d:f9e1 with SMTP id u6-20020a05622a198600b00343225df9e1mr2713499qtc.651.1661590094331;
Sat, 27 Aug 2022 01:48:14 -0700 (PDT)
X-Received: by 2002:a25:2e50:0:b0:669:9a76:beb with SMTP id
b16-20020a252e50000000b006699a760bebmr2676223ybn.597.1661590094049; Sat, 27
Aug 2022 01:48:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sat, 27 Aug 2022 01:48:13 -0700 (PDT)
In-Reply-To: <2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:c7f:9974:4800:7881:fc47:367c:e9e8;
posting-account=abq7qAoAAAD7_AcDzw5YjS2HVEynJOrt
NNTP-Posting-Host: 2a02:c7f:9974:4800:7881:fc47:367c:e9e8
References: <tebblf$2gpm$1@dont-email.me> <2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: fiziqs@gmail.com (fiz...@gmail.com)
Injection-Date: Sat, 27 Aug 2022 08:48:14 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2160
 by: fiz...@gmail.com - Sat, 27 Aug 2022 08:48 UTC

On Saturday, August 27, 2022 at 5:31:37 AM UTC+2, Robin Vowels wrote:
> On Saturday, August 27, 2022 at 6:49:55 AM UTC+10, Lynn McGuire wrote:
> FORTRAN followed centuries-old mathematical convention.
Nope. Just as the linked article mentions, in Mathematics, starting an index from 0 or 1 are both often used, e.g., for elements of sequences and series, 0 seems to be most often used, for vector and matrix indices, 1. If a convergence of a sequence is considered, you often don't care about "early" elements, so, if that yields a simple formula, you start from any number convenient. In Physics, you often start vector and matrix indices with 0 if the zeroth component is in some sense distinguished (e.g., in relativistic theories, distinguishing the time-like coordinate from the 3 space-like ones).
> FORTRAN started at 1 for subscripts.

Re: “Why do arrays start at 0?"

<22855686-fa84-4d0d-9790-b883cf1244cdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2741&group=comp.lang.fortran#2741

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a0c:8ecc:0:b0:473:2fa4:df7c with SMTP id y12-20020a0c8ecc000000b004732fa4df7cmr2743447qvb.55.1661591878785;
Sat, 27 Aug 2022 02:17:58 -0700 (PDT)
X-Received: by 2002:a81:e0a:0:b0:31e:2180:2b39 with SMTP id
10-20020a810e0a000000b0031e21802b39mr3174624ywo.319.1661591878511; Sat, 27
Aug 2022 02:17:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sat, 27 Aug 2022 02:17:58 -0700 (PDT)
In-Reply-To: <8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:9c6b:ce36:eedd:ad0a;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:9c6b:ce36:eedd:ad0a
References: <tebblf$2gpm$1@dont-email.me> <2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
<8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <22855686-fa84-4d0d-9790-b883cf1244cdn@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 27 Aug 2022 09:17:58 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: gah4 - Sat, 27 Aug 2022 09:17 UTC

On Saturday, August 27, 2022 at 1:48:15 AM UTC-7, fiz...@gmail.com wrote:
> On Saturday, August 27, 2022 at 5:31:37 AM UTC+2, Robin Vowels wrote:
> > On Saturday, August 27, 2022 at 6:49:55 AM UTC+10, Lynn McGuire wrote:
> > FORTRAN followed centuries-old mathematical convention.
> Nope. Just as the linked article mentions, in Mathematics, starting an index
> from 0 or 1 are both often used, e.g., for elements of sequences and series,
> 0 seems to be most often used, for vector and matrix indices, 1.

Yes, so array indexing is 1. Series sums start at zero, but are not indexed.

> If a convergence of a sequence is considered, you often don't care about
>"early" elements, so, if that yields a simple formula, you start from any
> number convenient.

Now for this case, you want a DO loop to start at zero, which Fortran 66
didn't allow. But you normally sum inside the loop, not store element
in an array.

> In Physics, you often start vector and matrix indices with 0 if the zeroth
> component is in some sense distinguished (e.g., in relativistic theories,
> distinguishing the time-like coordinate from the 3 space-like ones).
Yes, four-vectors.

Re: “Why do arrays start at 0?"

<teco73$ce2$1@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2742&group=comp.lang.fortran#2742

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!news.swapon.de!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: “Why do arrays start at 0?"
Date: Sat, 27 Aug 2022 09:30:11 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <teco73$ce2$1@newsreader4.netcologne.de>
References: <tebblf$2gpm$1@dont-email.me>
<2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
<8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>
<22855686-fa84-4d0d-9790-b883cf1244cdn@googlegroups.com>
Injection-Date: Sat, 27 Aug 2022 09:30:11 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:4e56:0:7285:c2ff:fe6c:992d";
logging-data="12738"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 27 Aug 2022 09:30 UTC

gah4 <gah4@u.washington.edu> schrieb:
> On Saturday, August 27, 2022 at 1:48:15 AM UTC-7, fiz...@gmail.com wrote:
>> On Saturday, August 27, 2022 at 5:31:37 AM UTC+2, Robin Vowels wrote:
>> > On Saturday, August 27, 2022 at 6:49:55 AM UTC+10, Lynn McGuire wrote:
>> > FORTRAN followed centuries-old mathematical convention.
>> Nope. Just as the linked article mentions, in Mathematics, starting an index
>> from 0 or 1 are both often used, e.g., for elements of sequences and series,
>> 0 seems to be most often used, for vector and matrix indices, 1.
>
> Yes, so array indexing is 1. Series sums start at zero, but are not indexed.
>
>> If a convergence of a sequence is considered, you often don't care about
>>"early" elements, so, if that yields a simple formula, you start from any
>> number convenient.
>
> Now for this case, you want a DO loop to start at zero, which Fortran 66
> didn't allow.

Really? You mean that

DO 10 I=0,1

would not be allowed?

You probably meant zero-trip loops which were undefined.

Re: “Why do arrays start at 0?"

<20220827120610.00002dd0@reddwarf.jmc.corp>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2743&group=comp.lang.fortran#2743

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx10.ams4.POSTED!not-for-mail
From: flibble@reddwarf.jmc.corp (Mr Flibble)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Message-ID: <20220827120610.00002dd0@reddwarf.jmc.corp>
References: <tebblf$2gpm$1@dont-email.me>
<tebfiv$2rs6$1@dont-email.me>
<20220827004602.000075b1@reddwarf.jmc.corp>
<tebvj6$1chn$1@gioia.aioe.org>
<87h71yjmya.fsf@nosuchdomain.example.com>
Organization: Jupiter Mining Corporation
X-Newsreader: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Lines: 38
X-Complaints-To: abuse@eweka.nl
NNTP-Posting-Date: Sat, 27 Aug 2022 11:06:10 UTC
Date: Sat, 27 Aug 2022 12:06:10 +0100
X-Received-Bytes: 2174
 by: Mr Flibble - Sat, 27 Aug 2022 11:06 UTC

On Fri, 26 Aug 2022 22:05:17 -0700
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:

> d thiebaud <thiebauddick2@aol.com> writes:
> > On 8/26/22 19:46, Mr Flibble wrote:
> >> On Fri, 26 Aug 2022 16:56:47 -0500
> >> Gary Scott <garylscott@sbcglobal.net> wrote:
> >>
> >>> On 8/26/2022 3:49 PM, Lynn McGuire wrote:
> >>>> “Why do arrays start at 0?"
> >>>>    https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
> >>>>
> >>>> "It's not the reason you think. No, it's not that reason either.”
> >>>>
> >>>> My Fortran starts at one.  My C++ starts at zero.  This has made
> >>>> my life hell.
> >>>>
> >>>> Lynn
> >>>>
> >>> Fortran was there first...and got it right...you can change
> >>> Fortran to start at other index values for many cases.
> >> Being first doesn't make you correct. Fortran is retarded.
> >> /Flibble
> >>
> > A reasonable language would let you specify the lower index. Fortran
> > and C are both retarded.
>
> "Mr Flibble" is a troll, and I'm sure he's aware that "retarded" is an
> offensive word. Are you?
Retarded isn't an offensive word but I could replace it with fucktarded
if that helps?

/Flibble

Re: “Why do arrays start at 0?"

<7db2d152-56f3-446c-9680-7208781aebe2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2744&group=comp.lang.fortran#2744

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:6214:5c85:b0:498:f448:f7e6 with SMTP id lj5-20020a0562145c8500b00498f448f7e6mr2152057qvb.73.1661602596033;
Sat, 27 Aug 2022 05:16:36 -0700 (PDT)
X-Received: by 2002:a0d:de83:0:b0:337:c0bf:12ee with SMTP id
h125-20020a0dde83000000b00337c0bf12eemr3454169ywe.289.1661602595876; Sat, 27
Aug 2022 05:16:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sat, 27 Aug 2022 05:16:35 -0700 (PDT)
In-Reply-To: <8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=202.67.103.232; posting-account=S_MdrwoAAAD7T2pxG2e393dk6y0tc0Le
NNTP-Posting-Host: 202.67.103.232
References: <tebblf$2gpm$1@dont-email.me> <2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
<8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7db2d152-56f3-446c-9680-7208781aebe2n@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: robin.vowels@gmail.com (Robin Vowels)
Injection-Date: Sat, 27 Aug 2022 12:16:36 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Robin Vowels - Sat, 27 Aug 2022 12:16 UTC

On Saturday, August 27, 2022 at 6:48:15 PM UTC+10, fiz...@gmail.com wrote:
> On Saturday, August 27, 2022 at 5:31:37 AM UTC+2, Robin Vowels wrote:
> > On Saturday, August 27, 2022 at 6:49:55 AM UTC+10, Lynn McGuire wrote:
> > FORTRAN followed centuries-old mathematical convention.
> Nope. Just as the linked article mentions, in Mathematics, starting an index from 0 or 1 are both often used, e.g., for elements of sequences and series, 0 seems to be most often used,
..
That's irrrelevnt to the OP's question.
..
for vector and matrix indices, 1.

That's what I said.
It's an old tradition.

> If a convergence of a sequence is considered, you often don't care about "early" elements, so, if that yields a simple formula, you start from any number convenient. In Physics, you often start vector and matrix indices with 0
..
Really? See above.
..
> if the zeroth component is in some sense distinguished (e.g., in relativistic theories, distinguishing the time-like coordinate from the 3 space-like ones).
..
> > FORTRAN started at 1 for subscripts.

Re: Re: “Why do arrays start at 0?"

<BSpOK.163814$ze2.78928@fx36.iad>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2745&group=comp.lang.fortran#2745

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx36.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Re: “Why do arrays start at 0?"
Newsgroups: comp.lang.fortran,comp.lang.c++
References: <tebblf$2gpm$1@dont-email.me> <tebfiv$2rs6$1@dont-email.me>
Lines: 18
Message-ID: <BSpOK.163814$ze2.78928@fx36.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 27 Aug 2022 14:28:49 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 27 Aug 2022 14:28:49 GMT
X-Received-Bytes: 1373
 by: Scott Lurndal - Sat, 27 Aug 2022 14:28 UTC

Gary Scott <garylscott@sbcglobal.net> writes:
>On 8/26/2022 3:49 PM, Lynn McGuire wrote:
>> “Why do arrays start at 0?"
>>    https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>>
>> "It's not the reason you think. No, it's not that reason either.”
>>
>> My Fortran starts at one.  My C++ starts at zero.  This has made my life
>> hell.
>>
>> Lynn
>>
>Fortran was there first...and got it right...you can change Fortran to
>start at other index values for many cases.

There are around twenty languages that start array indicies with one. None of
them are low-level hardware-oriented languages (Burroughs algol excepted) like C. In the
hardware indicies start at zero by definition.

Re: “Why do arrays start at 0?"

<e9ab592e-6c95-4399-918c-3dd5f8a0c3b1n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2746&group=comp.lang.fortran#2746

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a0c:e292:0:b0:496:db60:ce1c with SMTP id r18-20020a0ce292000000b00496db60ce1cmr4197517qvl.35.1661619662104;
Sat, 27 Aug 2022 10:01:02 -0700 (PDT)
X-Received: by 2002:a0d:de83:0:b0:337:c0bf:12ee with SMTP id
h125-20020a0dde83000000b00337c0bf12eemr4152569ywe.289.1661619661876; Sat, 27
Aug 2022 10:01:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sat, 27 Aug 2022 10:01:01 -0700 (PDT)
In-Reply-To: <teco73$ce2$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:20d3:ecfa:c161:2e96;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:20d3:ecfa:c161:2e96
References: <tebblf$2gpm$1@dont-email.me> <2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
<8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com> <22855686-fa84-4d0d-9790-b883cf1244cdn@googlegroups.com>
<teco73$ce2$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e9ab592e-6c95-4399-918c-3dd5f8a0c3b1n@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 27 Aug 2022 17:01:02 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2029
 by: gah4 - Sat, 27 Aug 2022 17:01 UTC

On Saturday, August 27, 2022 at 2:30:15 AM UTC-7, Thomas Koenig wrote:

(snip)

> > Now for this case, you want a DO loop to start at zero, which Fortran 66
> > didn't allow.

> Really? You mean that
> DO 10 I=0,1
> would not be allowed?
Yes, not allowed. And the IBM compilers wouldn't compile them
with a constant. BXLE works fine with variables, though.
That was another change in Fortran 77.

> You probably meant zero-trip loops which were undefined.

And yes, even though the standard said undefined, many compilers
implemented the one-trip minimum, with the test at the end.
And so many believed that was required.

Re: “Why do arrays start at 0?"

<tedqnk$1414$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2747&group=comp.lang.fortran#2747

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!Ojo9tLwCkFeEtRnxG8QQ3g.user.46.165.242.75.POSTED!not-for-mail
From: thiebauddick2@aol.com (d thiebaud)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Sat, 27 Aug 2022 15:19:16 -0400
Organization: Aioe.org NNTP Server
Message-ID: <tedqnk$1414$1@gioia.aioe.org>
References: <tebblf$2gpm$1@dont-email.me>
<tecb60$5sh$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="36900"; posting-host="Ojo9tLwCkFeEtRnxG8QQ3g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: d thiebaud - Sat, 27 Aug 2022 19:19 UTC

On 8/27/22 01:47, Thomas Koenig wrote:
> Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
>> “Why do arrays start at 0?"
>> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>>
>> "It's not the reason you think. No, it's not that reason either.”
>>
>> My Fortran starts at one. My C++ starts at zero. This has made my life
>> hell.
>
> If you want to declare your Fortran arrays to start at zero, just
> declare them with a lower bound of zero, like
>
> real, dimension(0:n-1) :: a

Can you declare other lower bounds the same way?

Re: “Why do arrays start at 0?"

<tedr4l$1cc0$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2748&group=comp.lang.fortran#2748

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!28Gug6axEez0hNfVDQSrFw.user.46.165.242.91.POSTED!not-for-mail
From: F.Zwarts@KVI.nl (Fred. Zwarts)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Sat, 27 Aug 2022 21:26:12 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tedr4l$1cc0$1@gioia.aioe.org>
References: <tebblf$2gpm$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="45440"; posting-host="28Gug6axEez0hNfVDQSrFw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.2.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: nl, en-GB
 by: Fred. Zwarts - Sat, 27 Aug 2022 19:26 UTC

Op 26.aug..2022 om 22:49 schreef Lynn McGuire:
> “Why do arrays start at 0?"
>    https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>
> "It's not the reason you think. No, it's not that reason either.”
>
> My Fortran starts at one.  My C++ starts at zero.  This has made my life
> hell.
>
> Lynn
>

I assumed that it was done because in C x[i] is equivalent to *(x+i).

Re: “Why do arrays start at 0?"

<3a510e33-5963-48b4-afe8-ffeb27aa5ad3n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2749&group=comp.lang.fortran#2749

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ad4:5cea:0:b0:497:c55:edb3 with SMTP id iv10-20020ad45cea000000b004970c55edb3mr4598119qvb.99.1661629526208;
Sat, 27 Aug 2022 12:45:26 -0700 (PDT)
X-Received: by 2002:a81:1187:0:b0:340:8567:fbed with SMTP id
129-20020a811187000000b003408567fbedmr4670106ywr.54.1661629525965; Sat, 27
Aug 2022 12:45:25 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Sat, 27 Aug 2022 12:45:25 -0700 (PDT)
In-Reply-To: <tedqnk$1414$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=108.52.103.144; posting-account=ZZXq9AoAAAAQEcA7zKAGm0UFQh4gMBv7
NNTP-Posting-Host: 108.52.103.144
References: <tebblf$2gpm$1@dont-email.me> <tecb60$5sh$1@newsreader4.netcologne.de>
<tedqnk$1414$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a510e33-5963-48b4-afe8-ffeb27aa5ad3n@googlegroups.com>
Subject: Re: “Why do arrays start at 0?"
From: parekhvs@gmail.com (FortranFan)
Injection-Date: Sat, 27 Aug 2022 19:45:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2939
 by: FortranFan - Sat, 27 Aug 2022 19:45 UTC

On Saturday, August 27, 2022 at 3:19:26 PM UTC-4, d thiebaud wrote:
> On 8/27/22 01:47, Thomas Koenig wrote:
> > Lynn McGuire schrieb:
> >> “Why do arrays start at 0?"
> >> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
> >>
> >> "It's not the reason you think. No, it's not that reason either.”
> >>
> >> My Fortran starts at one. My C++ starts at zero. This has made my life
> >> hell.
> >
> > If you want to declare your Fortran arrays to start at zero, just
> > declare them with a lower bound of zero, like
> >
> > real, dimension(0:n-1) :: a
> Can you declare other lower bounds the same way?

Re: "Can you declare other lower bounds the same way?", yes.

Below is a simple example with the so-called assume-shape array parameters where array descriptors come into play during procedure invocation:

real :: x(2,3,4)
x = reshape( [( i, integer :: i = 1, size(x) )], shape=shape(x) )
call sub( x )
contains
subroutine sub( a )
real, intent(in) :: a( -1:, -2:, -3: )
print *, "lbound(a, dim=1) = ", lbound(a, dim=1)
print *, "lbound(a, dim=2) = ", lbound(a, dim=2)
print *, "lbound(a, dim=3) = ", lbound(a, dim=3)
print *, a
end subroutine
end

The program based on above source can produce the following output:
lbound(a, dim=1) = -1
lbound(a, dim=2) = -2
lbound(a, dim=3) = -3
1.000000 2.000000 3.000000 4.000000 5.000000
6.000000 7.000000 8.000000 9.000000 10.00000
11.00000 12.00000 13.00000 14.00000 15.00000
16.00000 17.00000 18.00000 19.00000 20.00000
21.00000 22.00000 23.00000 24.00000

Re: “Why do arrays start at 0?"

<tedt6n$757$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2750&group=comp.lang.fortran#2750

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!aioe.org!mdf2aNOb2oCHynmZpuX5uw.user.46.165.242.91.POSTED!not-for-mail
From: lynnmcguire5@gmail.com (Lynn McGuire)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Sat, 27 Aug 2022 15:01:25 -0500
Organization: Aioe.org NNTP Server
Message-ID: <tedt6n$757$1@gioia.aioe.org>
References: <tebblf$2gpm$1@dont-email.me> <tedr4l$1cc0$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="7335"; posting-host="mdf2aNOb2oCHynmZpuX5uw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.2.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Lynn McGuire - Sat, 27 Aug 2022 20:01 UTC

On 8/27/2022 2:26 PM, Fred. Zwarts wrote:
> Op 26.aug..2022 om 22:49 schreef Lynn McGuire:
>> “Why do arrays start at 0?"
>>
>> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>>
>> "It's not the reason you think. No, it's not that reason either.”
>>
>> My Fortran starts at one.  My C++ starts at zero.  This has made my
>> life hell.
>>
>> Lynn
>>
>
> I assumed that it was done because in C x[i] is equivalent to *(x+i).

Yup. So Fortran x(i) is equivalent to *(x+i-1). Or, the x is
subtracted from first: x--; *(x+i);.

Lynn

Re: “Why do arrays start at 0?"

<tee4th$cqm$2@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2751&group=comp.lang.fortran#2751

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: “Why do arrays start at 0?"
Date: Sat, 27 Aug 2022 22:13:05 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tee4th$cqm$2@newsreader4.netcologne.de>
References: <tebblf$2gpm$1@dont-email.me>
<2ec469de-b871-4fe7-bafd-9ae32e40a434n@googlegroups.com>
<8a00a39d-e43d-42ee-8620-8090645fc43bn@googlegroups.com>
<22855686-fa84-4d0d-9790-b883cf1244cdn@googlegroups.com>
<teco73$ce2$1@newsreader4.netcologne.de>
<e9ab592e-6c95-4399-918c-3dd5f8a0c3b1n@googlegroups.com>
Injection-Date: Sat, 27 Aug 2022 22:13:05 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:4e56:0:7285:c2ff:fe6c:992d";
logging-data="13142"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 27 Aug 2022 22:13 UTC

gah4 <gah4@u.washington.edu> schrieb:
> On Saturday, August 27, 2022 at 2:30:15 AM UTC-7, Thomas Koenig wrote:
>
> (snip)
>
>> > Now for this case, you want a DO loop to start at zero, which Fortran 66
>> > didn't allow.
>
>> Really? You mean that
>
>> DO 10 I=0,1
>
>> would not be allowed?
>
> Yes, not allowed.

I have the Fortran 66 standard before me, and I find no such
restriction in 7.1.2.8 (nor would it make sense at all).

Which part of the standard are you referring to?

Re: “Why do arrays start at 0?"

<tee5f1$cqm$3@newsreader4.netcologne.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2752&group=comp.lang.fortran#2752

  copy link   Newsgroups: comp.lang.fortran comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran,comp.lang.c++
Subject: Re: “Why do arrays start at 0?"
Date: Sat, 27 Aug 2022 22:22:25 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <tee5f1$cqm$3@newsreader4.netcologne.de>
References: <tebblf$2gpm$1@dont-email.me>
<tecb60$5sh$1@newsreader4.netcologne.de> <tedqnk$1414$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 27 Aug 2022 22:22:25 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-4e56-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:4e56:0:7285:c2ff:fe6c:992d";
logging-data="13142"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 27 Aug 2022 22:22 UTC

d thiebaud <thiebauddick2@aol.com> schrieb:
> On 8/27/22 01:47, Thomas Koenig wrote:
>> Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
>>> “Why do arrays start at 0?"
>>> https://buttondown.email/hillelwayne/archive/why-do-arrays-start-at-0/
>>>
>>> "It's not the reason you think. No, it's not that reason either.”
>>>
>>> My Fortran starts at one. My C++ starts at zero. This has made my life
>>> hell.
>>
>> If you want to declare your Fortran arrays to start at zero, just
>> declare them with a lower bound of zero, like
>>
>> real, dimension(0:n-1) :: a
>
> Can you declare other lower bounds the same way?

Yes.

You can, since 1991, when Fortran 90 was released, do

real, dimension(from:to) :: a

where from and to are arbitrary integer expressions. (If to <
from, then you get a zero-sized array, which is perfectly valid
and which just happens to have size zero and no element).

(In Fortran, you cannot declare variables in the middle of
code. If you want to do that, Fortran 2008 introduced the
BLOCK construct for declaring variables, much like
C's or C++'s { and }, so you can do

read (*,*) from, to
block
real, dimension(from:to) :: a
! Use a here
end block

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor