Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!greg From: greg@utcsri.UUCP (Gregory Smith) Newsgroups: net.lang.c Subject: Re: Casting a postdecrement operand Message-ID: <2882@utcsri.UUCP> Date: Sun, 1-Jun-86 12:21:29 EDT Article-I.D.: utcsri.2882 Posted: Sun Jun 1 12:21:29 1986 Date-Received: Sun, 1-Jun-86 12:24:08 EDT References: <114@romp.UUCP> <2842@utcsri.UUCP> <378@dg_rtp.UUCP> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 28 Summary: In article <378@dg_rtp.UUCP> throopw@dg_rtp.UUCP (Wayne Throop) writes: >there are two interesting issues here. First, the fact that the >compiler allows a cast to be used as an lvalue is bogus in the first >place. That compiler, quite simply, allowed an illegal operation. [me:] >> This is perfectly legal, but lint might well want to prod you about it... > >It is *not* legal, perfectly or imperfectly. And lint *had* *better* >prod you about it. (It does, by the way. It says "illegal lhs of >assignment".) >...once you have cast the pointer, you cannot use the cast >expression as an lvalue. K&R say this is illegal, Harbison and Steele >say this is illegal, and the ANSI draft says this is illegal. I mean, >when the Father, the Son, and the Holy Ghost say it's illegal, I say it >is then, now, and evermore, *ILLEGAL*. >-- >Wayne Throop !mcnc!rti-sel!dg_rtp!throopw I stand corrected. I couldn't find anything explicitly forbidding or allowing this in K&R, ( I still can't ) so I gave that compiler the benefit of the doubt, without trying it here. Reasonable semantics could be defined for the operation, but I don't know how useful it is. -- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg