This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlined as trees
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Linus Torvalds <torvalds at transmeta dot com>
- Cc: Gabriel Dos Reis <gdr at codesourcery dot com>, Richard Henderson <rth at redhat dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: 14 Dec 2001 16:34:52 -0200
- Subject: Re: Volatile MEMs in statement expressions and functions inlined as trees
- Organization: GCC Team, Red Hat
- References: <Pine.LNX.4.33.0112140836440.2821-100000@penguin.transmeta.com>
On Dec 14, 2001, Linus Torvalds <torvalds@transmeta.com> wrote:
> The fact is, C++ does NOT "create" addresses for true rvalues.
Guess what: it does.
Think:
class foo {
public:
void method();
};
foo func();
/// ...
func().method();
This is legal C++. The rvalue of type foo returned by func() (and
it's an rvalue, not an lvalue, because func returns a foo, not a foo&
[expr.call]/10) has an address, and it's precisely its address that is
passed as the `this' implicit argument to foo::method().
> Remember: "lvalue" fundamentally means "addressable".
In C, but that breaks down in C++.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me