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,bd45e29f9dafca87 X-Google-Attributes: gid103376,public From: Ole-Hjalmar Kristensen Subject: Re: bitwise comparators Date: 2000/01/19 Message-ID: #1/1 X-Deja-AN: 574612567 Sender: ohk@gong2.clustra.com References: <3880D375.7E363123@hotmail.com> <38829638.0@news.pacifier.com> <3882FC1C.2BA8C959@hotmail.com> <85vmn2$ki1$1@nnrp1.deja.com> <38836CF2.AB738B8B@hotmail.com> <3883A414.8559E641@earthlink.net> X-Complaints-To: abuse@telia.no X-Trace: news.telia.no 948272271 195.204.160.194 (Wed, 19 Jan 2000 09:57:51 CET) Organization: Telia Internet Public Access NNTP-Posting-Date: Wed, 19 Jan 2000 09:57:51 CET Newsgroups: comp.lang.ada Date: 2000-01-19T00:00:00+00:00 List-Id: Keith Thompson writes: > Jeff Carter writes: > [...] > > > With true arrays, do you mean out of bound checking, etc? This can be done > > > with _proper_ programming in C! > > > > C does not have arrays; it only has different notations for address > > arithmetic. > > That's a slight exaggeration. C does have array types and array > objects. For example this: > int a[10]; > declares a as an array of 10 ints, very much like Ada's > A: array(0 .. 9) of Integer; > It does not, contrary to popular misconception, declare a as a > pointer. > > What often causes confusion is that, in most expression contexts, a > reference to the name of an array object "decays" to a pointer to the > array's first element. > > C arrays are not first-class types, but they do exist. > > -- > Keith Thompson (The_Other_Keith) kst@cts.com > San Diego Supercomputer Center <*> > Welcome to the last year of the 20th century. I would say you are both right. C guarantees that in your example, a is a constant pointer. I also guarantees that a[i] == *(a+i). A somewhat curious fact is that i[a] == *(i+a) == *(a+i), so it is completely legal C to write for instance : 9[a] = 13; The only use of this is probably if you're competing in the obfuscated C code contest :-) Ole-Hj. Kristensen -- E pluribus Unix