Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!ucsd!pacbell.com!tandem!jimbo From: jimbo@tandem.com (Jim Lyon) Newsgroups: comp.lang.c Subject: Re: What's an LValue [was A quick question] Message-ID: <1991Mar13.050555.26149@tandem.com> Date: 13 Mar 91 05:05:55 GMT References: <1991Mar12.030759.26698@nntp-server.caltech.edu> <31306@shamash.cdc.com> Sender: news@tandem.com Organization: Tandem Computers, Inc. Lines: 21 Nntp-Posting-Host: suntan.tandem.com In article <31306@shamash.cdc.com> bls@u02.svl.cdc.com (Brian Scearce) writes: >The rules are pretty easy (especially if you have your copy of >Harbison and Steele on your desk :-) > >0. variable names (excepting function, array and enum constant > names) are lvalues. >1. e[k] is an lvalue, regardless of whether e and k are lvalues. >2. (e) is an lvalue iff e is. >3. e.name is an lvalue iff e is. >4. e->name is an lvalue regardless of whether e is an lvalue. >5. *e is an lvalue regardless of whether e is an lvalue. Rules (1) and (5) need to be further qualified. e[k] and *e are lvalues regardless of whether e and k are lvalues, UNLESS the type of e[k] or *e is either Array... or Function... For example, if A is declared as "int A[10][10]", then "A[5]" is not an lvalue, because the type of "A[5]" is "Array of int". -- Jim Lyon jimbo@Tandem.Com