[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: undefined compound chaining behavior
From: |
Hossein Sajjadi |
Subject: |
Re: undefined compound chaining behavior |
Date: |
Fri, 13 Jun 2014 10:03:03 +0330 |
On 6/13/14, Stefan Seefeld <address@hidden> wrote:
> 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...
>
>
Even if subexpressions is broken up ,the result may be different
depends on different conditions,since evaluations in C++ are
unsequenced.
I expressed that with a figure.
-Hossein
operator.png
Description: PNG image
- Re: undefined compound chaining behavior, (continued)
- Re: undefined compound chaining behavior, Benjamin Abbott, 2014/06/13
- Re: undefined compound chaining behavior, John W. Eaton, 2014/06/13
- Re: undefined compound chaining behavior, Mike Miller, 2014/06/13
- Re: undefined compound chaining behavior, John W. Eaton, 2014/06/13
- Re: undefined compound chaining behavior, Michael D. Godfrey, 2014/06/13
- Re: undefined compound chaining behavior, Hossein Sajjadi, 2014/06/13
- Should "ans" include all side effects?, Daniel J Sebald, 2014/06/13
- Re: Should "ans" include all side effects?, Daniel J Sebald, 2014/06/13
- Re: Should "ans" include all side effects?, Daniel J Sebald, 2014/06/13
- Re: undefined compound chaining behavior, Stefan Seefeld, 2014/06/12
- Re: undefined compound chaining behavior,
Hossein Sajjadi <=
- Re: undefined compound chaining behavior, Benjamin Abbott, 2014/06/10
- Re: undefined compound chaining behavior, Hossein Sajjadi, 2014/06/10
- Re: undefined compound chaining behavior, John W. Eaton, 2014/06/10