octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: undefined compound chaining behavior


From: Stefan Seefeld
Subject: Re: undefined compound chaining behavior
Date: Thu, 12 Jun 2014 23:16:19 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 2014-06-12 21:24, Hossein Sajjadi wrote:
> Again we analyse the expression
> a=1
> a+=(a+=4)
> It is shown that the operator in both langauges is the same.

Even if you can show that operator+= is the same in both, that doesn't
mean that the ternary expression "a+=a+=4" maps from Octave straight to
C++. In fact, as others have said, such compound expressions are broken
up, so the C++ compiler never sees this as a single expression, but
rather as two binary ones (with a temporary, just as Jordi pointed out.)

Thus, these expressions are in fact not equivalent. (You could think of
it as Octave injecting synthetic sequence points, if that helps.)

        Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]