From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Ada is 'better' than C because... Date: 1996/08/09 Message-ID: #1/1 X-Deja-AN: 173210665 references: <01bb7bf9$b89a1740$96ee6fcf@timhome2> <4tj43k$16r@newsbf02.news.aol.com> <3205F296.41C6@wgs.estec.esa.nl> <320a638d.534305610@netline-fddi.jpl.nasa.gov> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada,comp.lang.c Date: 1996-08-09T00:00:00+00:00 List-Id: Kevin said " On 8 Aug 1996 00:22:01 -0400, dewar@cs.nyu.edu (Robert Dewar) wrote: >Sandy said > >"Since when was pointer arithmetic "essential"? It is simply convenient." > >Avoiding pointer arithmetic in C is pretty restrictive, it means not >using arrays at all (remember that in C the notation a[b] is simply >a shorthand for pointer arithmetic). That's a meaningful argument. Based on this, all lanaguages have pointer arithmetic, and it ain't so. No, that's quite wrong. Semantically in C, a[b] is just syntactic sugar for *(a+b), and to emphasize this, it is always fine in C to replace a[b] by b[a] (where a is the "array" and b is the "subscript"). In almost all other Algol style languages, and in Fortran, array subscripting is a first class operation in the language. Quite a big difference! So the claim that all languages have pointer arithmetic semantics and use them when the index arrays is quite wrong (for example it would be perfectly fine in Ada to use hash tables to represent arrays).