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 astrees
- From: Jason Merrill <jason at redhat dot com>
- To: Linus Torvalds <torvalds at transmeta dot com>
- Cc: aoliva at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 06 Dec 2001 23:34:53 +0000
- Subject: Re: Volatile MEMs in statement expressions and functions inlined astrees
- References: <200112062308.fB6N8un18531@penguin.transmeta.com>
>>>>> "Linus" == Linus Torvalds <torvalds@transmeta.com> writes:
> In article <or4rn9fqka.fsf@free.redhat.lsd.ic.unicamp.br> you write:
>>
>> volatile int *p, *q, r;
>>
>> void foo() {
>> *p = *q = r; // don't load *p back
>> }
> Does this still load off "q"?
> I don't think that's what an assignment operator implies.
> An assignment operator will assign the value to the left side, and have
> as its value the assigned value. NOT the "re-loaded value".
This is a difference between C and C++. In C, the result of *q = r is an
rvalue. In C++, it is an lvalue.
Jason