Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!watnot!ccplumb From: ccplumb@watnot.UUCP Newsgroups: comp.lang.c Subject: Re: incrementing after a cast Message-ID: <12303@watnot.UUCP> Date: Tue, 16-Dec-86 12:39:23 EST Article-I.D.: watnot.12303 Posted: Tue Dec 16 12:39:23 1986 Date-Received: Wed, 17-Dec-86 20:41:52 EST References: <349@apple.UUCP> <7376@utzoo.UUCP> <1746@batcomputer.tn.cornell.edu> Reply-To: ccplumb@watnot.UUCP (Colin Plumb) Organization: U of Waterloo, Ontario Lines: 24 In article <755@dg_rtp.UUCP> throopw@dg_rtp.UUCP (Wayne Throop) writes: > >Can someone explain why anybody who has thought about it for more >than a few minutes WOULD expect that last example, or things like >((sometype *)p)++, to work? I think the idea is it should act like... temp = (sometype)p p = (p'stype *)(temp++) ...which is what you could expect on a system where the type coercion is a null operation (the bit patterns of p and (sometype *)p are identical), so the temporary variable that holds (sometype *)p, and gets incremented by the ++, is p itself. Of course, if the compiler checks syntax more carefully, or is on a system where the bit patterns of the two types are different, this will bomb out instantly. -Colin Plumb (ccplumb@watnot.UUCP) Zippy says: But was he mature enough last night at the lesbian masquerade?