Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #76825 > unrolled thread
| Started by | G G <gdotone@gmail.com> |
|---|---|
| First post | 2015-11-21 18:50 -0800 |
| Last post | 2015-11-23 07:49 -0800 |
| Articles | 20 on this page of 42 — 18 participants |
Back to article view | Back to comp.lang.c
just a curiosity about starting array indexing at 0 as opposed to 1 G G <gdotone@gmail.com> - 2015-11-21 18:50 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 supercat@casperkitty.com - 2015-11-21 19:31 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-11-22 00:15 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 supercat@casperkitty.com - 2015-11-22 07:20 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-22 16:22 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 supercat@casperkitty.com - 2015-11-22 08:44 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-22 10:37 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-22 15:50 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-22 11:02 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-22 16:15 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Ian Collins <ian-news@hotmail.com> - 2015-11-22 16:42 +1300
Re: just a curiosity about starting array indexing at 0 as opposed to 1 G G <gdotone@gmail.com> - 2015-11-21 19:55 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Keith Thompson <kst-u@mib.org> - 2015-11-23 11:01 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-23 19:18 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Keith Thompson <kst-u@mib.org> - 2015-11-23 11:26 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-23 22:54 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Robert Wessel <robertwessel2@yahoo.com> - 2015-11-23 18:37 -0600
Re: just a curiosity about starting array indexing at 0 as opposed to 1 raltbos@xs4all.nl (Richard Bos) - 2015-11-24 15:22 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 raltbos@xs4all.nl (Richard Bos) - 2015-11-24 15:13 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-22 01:21 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-22 15:00 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-22 10:15 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-23 13:47 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-23 14:50 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-23 12:01 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 James Kuyper <jameskuyper@verizon.net> - 2015-11-23 12:12 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-23 12:57 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-23 23:08 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 bert <bert.hutchings@btinternet.com> - 2015-11-23 08:52 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-22 15:42 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Keith Thompson <kst-u@mib.org> - 2015-11-22 12:36 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-22 21:06 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-22 10:28 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 gazelle@shell.xmission.com (Kenny McCormack) - 2015-11-22 12:04 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-22 11:24 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 G G <gdotone@gmail.com> - 2015-11-22 04:29 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 see.my.homepage@gmail.com - 2015-11-22 04:54 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 BartC <bc@freeuk.com> - 2015-11-22 13:43 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 James Kuyper <jameskuyper@verizon.net> - 2015-11-22 11:04 -0500
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> - 2015-11-22 15:29 +0000
Re: just a curiosity about starting array indexing at 0 as opposed to 1 Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-22 14:06 -0800
Re: just a curiosity about starting array indexing at 0 as opposed to 1 John Bode <jfbode1029@gmail.com> - 2015-11-23 07:49 -0800
Page 1 of 3 [1] 2 3 Next page →
| From | G G <gdotone@gmail.com> |
|---|---|
| Date | 2015-11-21 18:50 -0800 |
| Subject | just a curiosity about starting array indexing at 0 as opposed to 1 |
| Message-ID | <2df732fe-b6ed-47a2-b61d-30d45a7cab91@googlegroups.com> |
Just a curiosity about C starting array subscripts at 0 as opposed to starting at 1. Did Kernaghan or Ritchie ever explain why they chose to have array subscripts start a 0? Is there a thought behind it, like it's intuitive to think that way when programming so close to the hardware (assembly language), so to speak? Or was it thought to be a natural starting position? Or just to be different from Pascal cause of copyrights, intellectual property... ? Just curious.
[toc] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2015-11-21 19:31 -0800 |
| Message-ID | <74bfe663-fc00-4e6b-84fa-ce18502fa8e7@googlegroups.com> |
| In reply to | #76825 |
On Saturday, November 21, 2015 at 8:50:53 PM UTC-6, G G wrote: > Did Kernaghan or Ritchie ever explain why they chose to > have array subscripts start a 0? The image I like to use of is to say think of array elements as being miles of roadway, and the indices as being the mile markers. The first element sits between mile markers 0 and 1, the second element between markers 1 and 2, etc. The "past-one" pointer is the mile marker past the last stretch of roadway, which doesn't have any roadway beyond it, but still adjoins an existing stretch of roadway.
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2015-11-22 00:15 -0800 |
| Message-ID | <28721e81-a482-4ad2-a28d-adbc69330e54@googlegroups.com> |
| In reply to | #76828 |
On Sunday, November 22, 2015 at 3:31:25 AM UTC, supe...@casperkitty.com wrote: > On Saturday, November 21, 2015 at 8:50:53 PM UTC-6, G G wrote: > > Did Kernaghan or Ritchie ever explain why they chose to > > have array subscripts start a 0? > > The image I like to use of is to say think of array elements as > being miles of roadway, and the indices as being the mile markers. > The first element sits between mile markers 0 and 1, the second > element between markers 1 and 2, etc. > The "past-one" pointer is the mile marker past the last stretch > of roadway,which doesn't have any roadway beyond it, but still > adjoins an existing stretch of roadway. > Except that you use the index to refer to the stretch between milestone 3 and milestone 4. So is the lorry at the milestone, or between milestones?
[toc] | [prev] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2015-11-22 07:20 -0800 |
| Message-ID | <b238b932-2e50-4aef-bbde-58481ee4f099@googlegroups.com> |
| In reply to | #76841 |
On Sunday, November 22, 2015 at 2:16:05 AM UTC-6, Malcolm McLean wrote: > Except that you use the index to refer to the stretch between milestone > 3 and milestone 4. So is the lorry at the milestone, or between > milestones? Given int arr[100]; uint32_t *p = arr[3]; uint8_t *q = arr[3]; *p = 1234; *q = 6; Since each "int" is four miles long, p identifies mile marker 12 [four times three]. So does q. *p identifies a 4-mile stretch starting at mile 12, while *q identifies a 1-mile stretch starting at the same point. a
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2015-11-22 16:22 +0000 |
| Message-ID | <n2spve$tpd$1@dont-email.me> |
| In reply to | #76871 |
On 22/11/2015 15:20, supercat@casperkitty.com wrote: > On Sunday, November 22, 2015 at 2:16:05 AM UTC-6, Malcolm McLean wrote: >> Except that you use the index to refer to the stretch between milestone >> 3 and milestone 4. So is the lorry at the milestone, or between >> milestones? > > Given > int arr[100]; > uint32_t *p = arr[3]; > uint8_t *q = arr[3]; > > *p = 1234; > *q = 6; > > Since each "int" is four miles long, p identifies mile marker 12 [four > times three]. So does q. *p identifies a 4-mile stretch starting at mile > 12, while *q identifies a 1-mile stretch starting at the same point. Here you're viewing the arrays in 'fence-post' mode. Fence-posts are numbered 0, 1, 2, 3 which can represent the distance of the post from the origin. The panels represent array panels and are most sensibly numbered 1, 2, 3. You can talk of relative offsets and distances with the posts because a post is thin, a single point, but a panel is large and you don't know if you're talking about the left, right or some arbitrary point in the middle. Both schemes have their uses. But for ordinary use of an array (and if you try and drag it away from defining it in terms of pointers), 1-based arrays can make sense. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2015-11-22 08:44 -0800 |
| Message-ID | <43c0e214-55ee-43d1-b573-a73339491724@googlegroups.com> |
| In reply to | #76885 |
On Sunday, November 22, 2015 at 10:22:31 AM UTC-6, Bart wrote: > You can talk of relative offsets and distances with the posts because a > post is thin, a single point, but a panel is large and you don't know if > you're talking about the left, right or some arbitrary point in the middle. In C there is a convention that objects extend upward from their base. That implies that if one uses a fence-post number to identify an object, one would use the post immediately below it. Note that if arrays were numbered starting at 1, that would imply that they would no longer have a "just past the end" address, but instead a "just before the beginning" one.
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2015-11-22 10:37 -0500 |
| Message-ID | <Iil4y.85421$og6.82256@fx06.iad> |
| In reply to | #76828 |
On Saturday November 21 2015 22:31, in comp.lang.c, "supercat@casperkitty.com" <supercat@casperkitty.com> wrote: > On Saturday, November 21, 2015 at 8:50:53 PM UTC-6, G G wrote: >> Did Kernaghan or Ritchie ever explain why they chose to >> have array subscripts start a 0? > > The image I like to use of is to say think of array elements as being miles > of roadway, and the indices as being the mile markers. The image I like to use is one of seats in a theatre where array indices are (row and) seat number. I sit down in a seat, and my wife sits next to me. No matter which seat number I sit at, I am exactly zero seats away from me, while my wife seat number is one away from mine. But, then again, I'm a reformed Assembler and COBOL programmer ;-) -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2015-11-22 15:50 +0000 |
| Message-ID | <n2so38$lms$1@dont-email.me> |
| In reply to | #76875 |
On 22/11/2015 15:37, Lew Pitcher wrote: > On Saturday November 21 2015 22:31, in comp.lang.c, "supercat@casperkitty.com" >> The image I like to use of is to say think of array elements as being miles >> of roadway, and the indices as being the mile markers. > > The image I like to use is one of seats in a theatre where array indices are > (row and) seat number. > > I sit down in a seat, and my wife sits next to me. No matter which seat number > I sit at, I am exactly zero seats away from me, while my wife seat number is > one away from mine. But, that's going to be the case no matter how your seat is numbered. What's it got to do with whether the row of seats is numbered from 0 or from 1? -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2015-11-22 11:02 -0500 |
| Message-ID | <7Gl4y.238215$af1.166163@fx04.iad> |
| In reply to | #76879 |
On Sunday November 22 2015 10:50, in comp.lang.c, "BartC" <bc@freeuk.com> wrote: > On 22/11/2015 15:37, Lew Pitcher wrote: >> On Saturday November 21 2015 22:31, in comp.lang.c, >> "supercat@casperkitty.com" > >>> The image I like to use of is to say think of array elements as being >>> miles of roadway, and the indices as being the mile markers. >> >> The image I like to use is one of seats in a theatre where array indices >> are (row and) seat number. >> >> I sit down in a seat, and my wife sits next to me. No matter which seat >> number I sit at, I am exactly zero seats away from me, while my wife seat >> number is one away from mine. > > But, that's going to be the case no matter how your seat is numbered. > > What's it got to do with whether the row of seats is numbered from 0 or > from 1? What does the seat numbering scheme have to do with where I sit? It doesn't. In this analogy, a seat number is the equivalent of an address. When my wife and I sit down in adjacent seats, we have, in effect, allocated an array of two elements from a wider memory field of the entire theatre. My seat, no matter what the address, is the zeroith seat from me, while my wife's seat, no matter what the address, is the 1th seat from me. -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2015-11-22 16:15 +0000 |
| Message-ID | <n2spil$rks$1@dont-email.me> |
| In reply to | #76881 |
On 22/11/2015 16:02, Lew Pitcher wrote: > On Sunday November 22 2015 10:50, in comp.lang.c, "BartC" <bc@freeuk.com> >> What's it got to do with whether the row of seats is numbered from 0 or >> from 1? > > What does the seat numbering scheme have to do with where I sit? It doesn't. > > In this analogy, a seat number is the equivalent of an address. When my wife > and I sit down in adjacent seats, we have, in effect, allocated an array of > two elements from a wider memory field of the entire theatre. My seat, no > matter what the address, is the zeroith seat from me, while my wife's seat, > no matter what the address, is the 1th seat from me. But your wife's seat won't be the 1th seat from herself! -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2015-11-22 16:42 +1300 |
| Message-ID | <dbcrtrFjpqnU9@mid.individual.net> |
| In reply to | #76825 |
G G wrote: > Just a curiosity about C starting array subscripts at 0 as > opposed to starting at 1. > > Did Kernaghan or Ritchie ever explain why they chose to > have array subscripts start a 0? To match the chapter numbering in their book? -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | G G <gdotone@gmail.com> |
|---|---|
| Date | 2015-11-21 19:55 -0800 |
| Message-ID | <1d9fce64-592c-4415-bc0b-d2380e7ad9b3@googlegroups.com> |
| In reply to | #76829 |
On Saturday, November 21, 2015 at 10:43:03 PM UTC-5, Ian Collins wrote: > G G wrote: > > Just a curiosity about C starting array subscripts at 0 as > > opposed to starting at 1. > > > > Did Kernaghan or Ritchie ever explain why they chose to > > have array subscripts start a 0? > > To match the chapter numbering in their book? Funny or maybe so. But then I fear we enter the discussion about which came first the chicken or the egg. :-) In this case, I think the language, but that was funny, well, it put a smile on my face.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-11-23 11:01 -0800 |
| Message-ID | <lnk2p835ht.fsf@kst-u.example.com> |
| In reply to | #76829 |
Ian Collins <ian-news@hotmail.com> writes:
> G G wrote:
>> Just a curiosity about C starting array subscripts at 0 as
>> opposed to starting at 1.
>>
>> Did Kernaghan or Ritchie ever explain why they chose to
>> have array subscripts start a 0?
>
> To match the chapter numbering in their book?
It is perhaps mildly interesting that K&R1 refers to the Introduction
as "Chapter 0", but K&R2 (at least in the Kindle version I have)
does not.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2015-11-23 19:18 +0000 |
| Message-ID | <n2vom6$l65$1@dont-email.me> |
| In reply to | #77020 |
On 23/11/2015 19:01, Keith Thompson wrote: > Ian Collins <ian-news@hotmail.com> writes: >> G G wrote: >>> Just a curiosity about C starting array subscripts at 0 as >>> opposed to starting at 1. >>> >>> Did Kernaghan or Ritchie ever explain why they chose to >>> have array subscripts start a 0? >> >> To match the chapter numbering in their book? > > It is perhaps mildly interesting that K&R1 refers to the Introduction > as "Chapter 0", but K&R2 (at least in the Kindle version I have) > does not. K&R2 seems firmly 1-based: * It's K&R2 not K&R1 (with the first edition K&R0) * The first pages start at (roman numeral) i not .... whatever 0 would have been in roman numerals * The main pages start at 1 not 0 * The chapters start at 1 not 0 (I understand K&R 1st ed. did start at 0) * The appendices start at A not @ (I don't know if A corresponds to 1 or 0, but the ASCII code for 'A' is odd.) * The appendix subheadings /are/ 1-based * There are other examples of ordinal, 1-based numbers outside the text itself (33rd printing etc) So perhaps the chapter 0 was just a joke that they didn't bother with for the new edition. -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2015-11-23 11:26 -0800 |
| Message-ID | <lnfuzw34by.fsf@kst-u.example.com> |
| In reply to | #77021 |
BartC <bc@freeuk.com> writes:
[...]
> * The chapters start at 1 not 0 (I understand K&R 1st ed. did start at 0)
In K&R1, the header on the introduction is "CHAPTER 0: INTRODUCTION".
In K&R2, it's just "INTRODUCTION". "Chapter 1: A Tutorial Introduction"
is the same in both (apart from case), so it's not a matter of the
chapters being renumbered.
[...]
> So perhaps the chapter 0 was just a joke that they didn't bother with
> for the new edition.
I agree.
The other 1-based conventions in both editions (page numbers et al) were
probably imposed by the publisher.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
|---|---|
| Date | 2015-11-23 22:54 +0000 |
| Message-ID | <n305ej$anc$1@speranza.aioe.org> |
| In reply to | #77023 |
Keith Thompson <kst-u@mib.org> wrote: > BartC <bc@freeuk.com> writes: (snip) >> So perhaps the chapter 0 was just a joke that they didn't bother with >> for the new edition. > I agree. > The other 1-based conventions in both editions (page numbers et al) were > probably imposed by the publisher. I suspect that the book publishing system does depend on odd numbers being on one side, and even on the other, and that you can't change which side those are. You might get away with putting a zero on the inside of the front cover, but books that put printing there. It is a favorite place to put reference material, such as a periodic table in a chemistry book. It might cost extra, though, in publishing. -- glen
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2015-11-23 18:37 -0600 |
| Message-ID | <7ua75bpn5ftacakhp3a014119819v1gfgt@4ax.com> |
| In reply to | #77040 |
On Mon, 23 Nov 2015 22:54:12 +0000 (UTC), glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote: >Keith Thompson <kst-u@mib.org> wrote: >> BartC <bc@freeuk.com> writes: > >(snip) >>> So perhaps the chapter 0 was just a joke that they didn't bother with >>> for the new edition. > >> I agree. > >> The other 1-based conventions in both editions (page numbers et al) were >> probably imposed by the publisher. > >I suspect that the book publishing system does depend on odd numbers >being on one side, and even on the other, and that you can't change >which side those are. Not really. While having odd numbers on the left (verso) page (and even on the right/recto) is pretty unusual, I don't think it would faze any publisher or printer. Reasonably(?) common is having the same number on both facing pages. Schildt's "The Annotated ANSI C Standard" is done that way, for example, for example page 101 verso (on the left) has section 7.2 of the standard (assert.h), and the facing 101 recto (right) has the annotations/commentary. Other publications with commentary or similar are sometimes published like that (I have a Chumash numbered like that, with the Hebrew on one side, and the translation on the other; and memory fails me, and I'm not near it at the moment to verify, but I think I have a Quran printed the same way). Bound maps are often printed like that. I also have a Chumash numbered conventionally, but it's printed RTL, so you flip the pages from what would be the back of a conventional book. There the odd pages are on the left side, and I really have no idea if that's then the recto or verso... I have seen books with section numbering (IOW the third page of section two is numbered "2-3"), where the convention of starting sections on a recto page is not strctly followed, resulting in odd numbers on the verso pages. This is probably most common in back matter (appendicies, notes, glossary, index, etc.), where the convention to start each section recto is not strong. That's also true of front matter past the table of contents, but that's rarely numbered in sections.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2015-11-24 15:22 +0000 |
| Message-ID | <56547ef1.595937@news.xs4all.nl> |
| In reply to | #77050 |
Robert Wessel <robertwessel2@yahoo.com> wrote: > I also have a Chumash numbered conventionally, but it's printed RTL, > so you flip the pages from what would be the back of a conventional > book. There the odd pages are on the left side, and I really have no > idea if that's then the recto or verso... Front is recto, back is verso. "Recto", in this case, does not mean "not left", but "proper" or "up-front". (And "verso" means "turned".) You always read recto first, then verso - if at all. In manuscripts with writing on only one side, that's the recto side. In Hebrew, I presume, if you did that, you'd write only on the left-hand page; therefore, in that case, recto is left. Also, in one-side-only cases, and other early manuscripts and prints, if there is a page number, it's generally one for each sheet, not each side. You then don't have 1 with its back side 2, opposite 3, back side 4; you have 1 recto, back side 1 verso, opposite 2 recto, back side 2 verso. In those cases, often (almost always?) only the recto is numbered. Richard
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2015-11-24 15:13 +0000 |
| Message-ID | <56547e75.471781@news.xs4all.nl> |
| In reply to | #77020 |
Keith Thompson <kst-u@mib.org> wrote: > Ian Collins <ian-news@hotmail.com> writes: > > G G wrote: > >> Just a curiosity about C starting array subscripts at 0 as > >> opposed to starting at 1. > >> > >> Did Kernaghan or Ritchie ever explain why they chose to > >> have array subscripts start a 0? > > > > To match the chapter numbering in their book? > > It is perhaps mildly interesting that K&R1 refers to the Introduction > as "Chapter 0", but K&R2 (at least in the Kindle version I have) > does not. Just as mildly interesting is that the 1982 Pascal British Standard - at least, the copy printed in the back of my handbook - does. Richard
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2015-11-22 01:21 -0500 |
| Message-ID | <v9d4y.153669$fC2.133336@fx03.iad> |
| In reply to | #76825 |
On Saturday November 21 2015 21:50, in comp.lang.c, "G G" <gdotone@gmail.com> wrote: > Just a curiosity about C starting array subscripts at 0 as > opposed to starting at 1. > > Did Kernaghan or Ritchie ever explain why they chose to > have array subscripts start a 0? It is implicit in the structure of arrays. K&R "The C Programming Language", Chapter 5 "Pointers and Arrays" "Rather more surprising, at least at first sight, is the fact that a reference to a[i] can also be written as *(a+i). In evaluating a[i], C converts it to *(a+i) immediately; the two forms are completely equivalent." If arrays started at any subscript other than zero, then a[subscript] could /not/ be equivalent to *(a+subscript) Consider: in a "arrays start at subscript 1" array, array[1] would be equivalent to *(array+0) and /not/ equivalent to *(array+1) -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | comp.lang.c
csiph-web