Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.lang.c,comp.bugs.4bsd
Subject: Re: lvalues and ++
Message-ID: <4727@mimsy.UUCP>
Date: Sat, 13-Dec-86 10:43:32 EST
Article-I.D.: mimsy.4727
Posted: Sat Dec 13 10:43:32 1986
Date-Received: Mon, 15-Dec-86 23:57:48 EST
References: <31da677c.809c@apollo.uucp>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 19
Xref: mnetor comp.lang.c:374 comp.bugs.4bsd:83

In article <31da677c.809c@apollo.uucp> mishkin@apollo.uucp
(Nathaniel Mishkin) writes:
>I am having problems with the construct:
>	char *p; 
>	*((long *)p)++;

We just went through this one.  Is someone reduplicating old news
with new dates?

The construct is not legal C, though some compilers accept it.  A
cast is semantically equivalent to an assignment to an unnamed
temporary variable of the given type.  If the postincrement were
to do anything, it would have to increment that unnamed temporary,
so the change would be lost forever.  Any compiler that increments
`p' by `sizeof (long)' is doubly wrong: once for accepting the
illegal construct, and again for incrementing the wrong variable!
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris@mimsy.umd.edu