Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!purdue!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: lvalues (was Re: Question about type casting) Message-ID: <10227@mimsy.UUCP> Date: 17 Jan 88 23:06:14 GMT References: <546@xyzzy.UUCP> <5080012@hpfcdc.HP.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 22 In some article somewhere, someone writes: >>I believe that Standard C does not allow type casting on the left of the >>= sign. In article <5080012@hpfcdc.HP.COM> boemker@hpfcdc.HP.COM (Tim Boemker) writes: >How about this: > >int i; char *c; >c = (char *) &i; >* (int *) c = 0; It is not portable, but it is legal. The result of a cast is an `rvalue' (R for Right: or in other words, the kind of thing one finds on the right hand side of an assignment). Assignments may be made only to `lvalues' (L for Left: the kind of thing found on the left hand side of an assignment). The C indirection operator `*' takes an rvalue and yeilds an lvalue, hence the result of `* (int *) c' is an lvalue. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris