This is the mail archive of the 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

Linus Torvalds <> writes:

| On 14 Dec 2001, Gabriel Dos Reis wrote:
| >
| > | But I'll give you that some rvalues can be _promoted_ to lvalues.
| >
| > There is no such rules C++.  You're inventing here.
| You already yourself pointed out some of the things allow the programmer
| to see the address of the rvalue.

But I didn't say they're promoted to lvalues.  You seem to equate
addressable to lvalue, which is fundamentally wrong.

| Once you have an address of an rvalue, you can _always_ make it an lvalue
| by the simple method of dereferencing it with "*".
| In effect, operations that expose the address of rvalues thus allow their
| promotion into lvalues. What's your argument?

My claim is that there is no promotion called rvalue-to-lvalue.
Please don't add to the confusion.

| Normally, of course, it goes the other way (ie lvalues get "demoted" to
| rvalues), by virtue of the operations wanting rvalues. A simple example,
| of course is just
| 	int a, b, c;
| 	a = b+c;
| where "b" is a lvalue, but because the "+" operation wants a rvalue it
| gets automatically converted, and the rvalue created by the dereferencing
| of "b".
| Or do you disagree here too?

Because operator+ expects an rvalue, the lvalue-to-rvalue conversion
is applied to b as explained by the standard text.  Did I said I
disagree with that?  I even quote a text to explain that.

-- Gaby
CodeSourcery, LLC             

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