Topic: Address-of operator yields an rvalue?


Author: thp@cs.ucr.edu
Date: Fri, 11 Jan 2002 12:20:44 CST
Raw View
Scott Meyers <smeyers@aristeia.com> wrote:
: All my compilers seem to agree that the result of taking the address of an
: object is an rvalue:

:   int i;
:   &i;         // the result of this expression is an rvalue of type int*

: I must be a dolt, because I can't find the place in the Standard where it
: says that the result of (the built-in) address-of operator is an rvalue.
: Would someone kindly point me to the right place to look?

I don't have my copy of the standard with me, but, IIRC, it says that
& returns a "pointer", which makes matters worse since both K&R and
The C++ Programming Language imply that pointers must be objects.

Tom Payne















---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Scott Meyers <smeyers@aristeia.com>
Date: Fri, 11 Jan 2002 13:04:39 CST
Raw View
On Fri, 11 Jan 2002 12:06:10 CST, Andrew Koenig wrote:
> It is not crystal clear, but 3.10 paragraph 4 is intended to mean that
> built-in operators yield lvalues only if clause 5 says so explicitly.

Yow, that's pretty uncrystalline.  For one thing, the entire paragraph is a
note.  For another, this sentence seems to be downright false:

  The discussion of each built-in operator in clause 5 indicates whether
  it expects lvalue operands and whether it yields an lvalue.

Certainly I see no mention of the rvalue- or lvalueness of the result in
5.3.1/2.  I think this would a good candidate for some cleanup in the next
Standard.

Thanks for the information.

Scott
--
Check out the *new* "THE C++ Seminar,"
http://www.gotw.ca/cpp_seminar/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Scott Meyers <smeyers@aristeia.com>
Date: Fri, 11 Jan 2002 11:13:32 CST
Raw View
All my compilers seem to agree that the result of taking the address of an
object is an rvalue:

  int i;
  &i;         // the result of this expression is an rvalue of type int*

I must be a dolt, because I can't find the place in the Standard where it
says that the result of (the built-in) address-of operator is an rvalue.
Would someone kindly point me to the right place to look?

Thanks,

Scott

--
Check out the *new* "THE C++ Seminar,"
http://www.gotw.ca/cpp_seminar/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Andrew Koenig <ark@research.att.com>
Date: Fri, 11 Jan 2002 12:06:10 CST
Raw View
Scott> All my compilers seem to agree that the result of taking the
Scott> address of an object is an rvalue:

Scott>   int i;
Scott>   &i;         // the result of this expression is an rvalue of type int*

Scott> I must be a dolt, because I can't find the place in the
Scott> Standard where it says that the result of (the built-in)
Scott> address-of operator is an rvalue.  Would someone kindly point
Scott> me to the right place to look?

It is not crystal clear, but 3.10 paragraph 4 is intended to mean that
built-in operators yield lvalues only if clause 5 says so explicitly.

--
Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]