Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-sdd!ncr-sd!se-sd!rns From: rns@se-sd.NCR.COM (Rick Schubert ) Newsgroups: comp.lang.c Subject: Re: Write-only variables Summary: This is really about lvalues Keywords: lvalue Message-ID: <2047@se-sd.NCR.COM> Date: 19 Sep 89 19:34:14 GMT References: <561@tigger.planet.bt.co.uk> <1989Sep14.183749.12753@jarvis.csri.toronto.edu> Reply-To: rns@se-sd.SanDiego.NCR.COM (Rick Schubert) Organization: NCR Corporation, SE-San Diego Lines: 32 Expires: Sender: Followup-To: In article <1989Sep14.183749.12753@jarvis.csri.toronto.edu> flaps@dgp.toronto.edu (Alan J Rosenthal) writes: >% humourously, in ansi C, not all lvalue expressions in C have meaning as >lvalues (namely, array names). This is true if your definition of "lvalue" is something that can be assigned to (i.e. appear as the left-hand side of an assignment operator); however, this is not how ANSI C defines `lvalue'. From 3.2.2.1: ______________________________________________________________________________ An `lvalue' is an expression (with an object type or an incomplete type other than |void|) that designates an object.* When an object is said to have a particular type, the type is specified by the lvalue used to designate the object. A `modifiable lvalue' is an lvalue that does not have array type, does not have an incomplete type, does not have a const-qualified type, and if it is a structure or union, does not have any member (including, recursively, any member of all contained structures or unions) with a const-qualified type. ________________ * The name "lvalue" comes originally from the assignment expression E1 = E2, in which the left operand E1 must be a (modifiable) lvalue. It is perhaps better considered as representing an object "locator value." What is sometimes called "rvalue" is in this Standard described as the "value of an expression." An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary expression that is a pointer to an object, *E is an lvalue that designates the object to which E points. ______________________________________________________________________________ -- Rick Schubert (rns@se-sd.sandiego.NCR.COM)