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

On 14 Dec 2001, Gabriel Dos Reis wrote:
> |
> | And the "value" is the "rvalue".
> Then how do you reconcile your position with the fact that you can
> have the adress of an rvalue in C++?

Ehh.. Not in general.

Try it. Easy enough with

	int * pp = &(p+1);

and it sure complains about "non-lvalue in unary &" and give a value of

The fact is, C++ does NOT "create" addresses for true rvalues.

The only thing C++ has is a much wider definition of lvalues. Many things
that are not lvalues in C are in fact lvalues in C++. Most (all?) of them
are forms of assignment (ie "p = 0", or "p++" etc).

> | The "rvalue" of an assignment expression is the value stored.
> Nobody is disputing that.

Yet you want the compiler to _reload_ it from 'p' in

	q = p = 0;

so you _are_ disputing that the "result" of "p = 0" is the "value stored".

> So my question is: What do you think assigments expect on the
> right-hand operand? An lvalue, an rvalue?

I have this silly claim that the "r" in "rvalue" comes from "right".

And that the "l" in "lvalue" comes from "left".

> | Can anybody buy into this way of thinking?
> I'm not sure I agree with you since *p is always an lvalue in C++ each
> time p is an expression of pointer type.

That's true in C too.

Remember: "lvalue" fundamentally means "addressable".

Now, if you have a "pointer type expression" p, then the expression "*p"
is _by_definition_ addressable - you have it's address, the pointer ("p").

> Nobody is denying that an rvalue is an entity by itself.

But you _are_.

You do seem to want to ignore the fact that the expression

	p = 0;

has a rvalue _in_and_of_itself_. You want to ignore that intrisic value,
and re-load it from "p". And the "rvalue liberation front" thinks that
you're being insensitive to the instrisic rvalue of the assignment by
refusing to acknowledge it, and only ever wanting to use the lvalue.

You _continue_ to claim that "q = p = 0" somehow forgets the "result is
the value stored" part. You seem to nullify that whole part of the
sentence, and I'm still asking you to explain what that part of the
sentence _means_ in your world-view.

According to you, the non-reloaded value is never even _used_, so what is
the point of having that "..the result is the value stored.." part at all?


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