Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Difference between these pointer syntaxes Date: Tue, 16 Aug 2016 15:22:29 -0700 Organization: None to speak of Lines: 41 Message-ID: References: <4628cd2d-9333-4be6-943a-eb593c5c4c12@googlegroups.com> <1c54e0e1-74f5-42d2-856b-7854a21028fc@googlegroups.com> <584e1695-e693-414c-8f79-0cda57282c14@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="21956"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193Mr5qBUBpJWfhBAnx0y/u" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:vRqZOPCqzc5zDcb4vHD/+Ng/Ky0= sha1:SMv2DODCpzZIvog+WWe51AcDU/g= Xref: csiph.com comp.lang.c:92347 supercat@casperkitty.com writes: > On Tuesday, August 16, 2016 at 2:47:00 PM UTC-5, Keith Thompson wrote: >> What is sometimes called "rvalue" is in this International Standard >> described as the "value of an expression". > > The Standard may have chosen to ignore the term "rvalue", but it describes > a concept which cannot I think be accurately summed up in the phrase used > by the Standard, though perhaps "evaluated value of an expression" might be > appropriate. > > int myArray[3] = {1,2,3}; > char *p = (char*)&(myArray[1]); > > upon what does the operator "&" act? From what I can tell, it acts upon > the expression "myArray[5]". Does that expression have a value? I would > say that it does--the value is 2. Does that mean that the expression is > an rvalue? Not as other documents use the term, because it isn't evaluated. > On the other hand, rather than use the phrase "evaluated value of an > expression" all the time, it might be easier to simply define the term > "rvalue" once and then use that. The way C uses the term (again, only in a footnote), an "rvalue" cannot be an expression. An "rvalue" is a *value* that results, at run time, from evaluating an expression. On the other hand, an "lvalue" as defined by the C standard is a kind of expression. (This is, as I understand it, different from the original meaning of the term.) In `&(myArray[1])`, the `&` operator is applied to the expression `(myArray[1])`, which is an lvalue. The value contained in `myArray[1]` (which happens to be 2) is not relevant, since no *lvalue conversion* takes place. I don't know what point you're trying to make. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"