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,2078dddcdcd8d83 X-Google-Attributes: gid103376,public From: ohk@fandango2-ether.nta.no (Ole-Hjalmar Kristensen FOU.TD/DELAB) Subject: Re: Warning: Religious naming convention discussion :-) [was: assign help!!] Date: 1997/05/14 Message-ID: #1/1 X-Deja-AN: 241437566 References: <5kjvcv$evt@news.cis.nctu.edu.tw> Organization: Telenor Online Public Access Newsgroups: comp.lang.ada Date: 1997-05-14T00:00:00+00:00 List-Id: In article dewar@merv.cs.nyu.edu (Robert Dewar) writes: Bob Duff said <<4. Array indexing is defined in terms of pointer arithmetic. (Well, I admit this is a rather weak reason.)>> Actually I think that's a bit backwards, I would say that pointer arithmetic in C is defined in terms of indexing in some sense. A pointer in C is conceptually a pair (base address, offset), and pointer arithmetic adjusts the offset, which is closely related to an array index. (indeed it is EXACTLY what COBOL would call an array index :-) But I agree with some of your other reasons, although I do not agree that pointers and arrays are synonymous in C, it is just that there are implicit coercions between these two types. >From "The C programming language", 2. ed., page 99: "The correspondence between indexing and pointer arithmetic is very close. By definition, the value of a variable or expression of type array is the address of element zero of the array." and further: "In short, an array-and-index expression is equivalent to one written as a pointer and offset"