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 astrees


>>>>> "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


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