Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!cornell!batcomputer!braner From: braner@batcomputer.tn.cornell.edu (braner) Newsgroups: comp.lang.c Subject: Re: incrementing after a cast Message-ID: <1762@batcomputer.tn.cornell.edu> Date: Mon, 8-Dec-86 01:53:30 EST Article-I.D.: batcompu.1762 Posted: Mon Dec 8 01:53:30 1986 Date-Received: Mon, 8-Dec-86 20:45:40 EST References: <349@apple.UUCP> <7376@utzoo.UUCP> <1746@batcomputer.tn.cornell.edu> <491@cartan.Berkeley.EDU> Reply-To: braner@batcomputer.UUCP (braner) Organization: Theory Center, Cornell University, Ithaca NY Lines: 20 Keywords: cast, increment, postincrement [] In article <1746@batcomputer.tn.cornell.edu> I wrote: >If ((sometype *)pointer)++ is not legal, then the law should be changed! >(since the pointer-type cast is legal, why can't you use the resulting >pointer like any pointer of sometype?) In article <491@cartan.Berkeley.EDU> ballou@brahms (Kenneth R. Ballou) wrote: >You can use the *VALUE* of the pointer in exactly the same way as you could >use the *VALUE* of any other pointer. ...the pre/post-increment >operator requires one of those mythical beasts, an l-value. Likewise, you >could not apply pre/post-increment to the result of a function call. - When you cast a pointer to a pointer of another type, you are telling the compiler to use it differently (e.g. to read 2 instead of 1 byte from memory when dereferencing). Since the compiler is aware of the cast in that sense, it COULD increment it according to the new type's size! I see no TECHNICAL obstacle here, only "legal" morass... - Moshe Braner