Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uxc!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Lvalues and casts Message-ID: <17738@mimsy.UUCP> Date: 25 May 89 03:27:58 GMT References: <847@tub.UUCP> <1989May23.225818.9602@utzoo.uucp> <1912@ektools.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 17 In article <1912@ektools.UUCP> randolph@ektools.UUCP (Gary L. Randolph) writes: >... I have an extension to the original question. I have >used casts on the LHS of assignment, but without actually assigning to >the cast. Example: ... >if (semaphore=='a') > *(int *)data = 22; >else if (semaphore=='b') > *(float *)data = 64; The result of a cast is not an lvalue, but the result of an indirection *is* an lvalue. These assignments are thus to lvalues and hence legal (provided, of course, the pointers point at the right objects). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris