This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Volatile MEMs in statement expressions and functions inlined as trees


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]