Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 (Tek) 9/26/83; site hercules.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!zehntel!tektronix!teklds!hercules!archiel From: archiel@hercules.UUCP (Archie Lachner) Newsgroups: net.lang.c Subject: Re: pointer question Message-ID: <155@hercules.UUCP> Date: Fri, 6-Apr-84 17:00:49 EST Article-I.D.: hercules.155 Posted: Fri Apr 6 17:00:49 1984 Date-Received: Sun, 8-Apr-84 07:05:43 EST References: <7624@mgweed.UUCP> <937@inuxc.UUCP> Organization: Tektronix, Beaverton OR Lines: 28 As I read Kernighan and Ritchie (K & R), the assertion that the statement p = p + 4; where p is a pointer, is dangerous and non-portable is completely wrong. In section 5.4, p. 98, it is stated that when an int or constant is added to a pointer, it is first scaled by the size of the object the pointer points to. For example, and I am quoting directly now, "The construction p + n means the n-th object beyond the one p currently points to." As far as I am concerned, K & R contains the definition of the C language. Expressions such as "p + 4" above are not dangerous and completely portable, at least to machines and systems where the C compiler implements the language correctly. -- Archie Lachner Logic Design Systems Division Tektronix, Inc. uucp: {ucbvax,decvax,pur-ee,cbosg,ihnss}!tektronix!teklds!archiel CSnet: archiel@tek ARPAnet: archiel.tek@rand-relay