Re: Same code and different result, Why?



Tommy wrote:
In other words:

int x = 36; y = 20;
int t = x++ + y++;
x = t;

*SHOULD* yield the same results as:

int x = 36; y = 20;
x = x++ + y++;

I'd say the second one could as well be evaluated like this:

x = x + y;
++x;
++y;

Why should it be exactly as you say instead?

Uli

--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
.



Relevant Pages

  • Re: Same code and different result, Why?
    ... Tommy wrote: ... misunderstanding English or at least one of us wants the other to ... Did you perhaps miss that your proposal and mine yield different results? ... C++ FAQ: http://parashift.com/c++-faq-lite ...
    (microsoft.public.vc.language)
  • Re: Should I use mutex in this context?
    ... Tommy wrote: ... What part of it do you consider rude? ... C++ FAQ: http://parashift.com/c++-faq-lite ... Sator Laser GmbH ...
    (microsoft.public.vc.language)
  • Re: Writing to a certain line?
    ... Tommy B wrote: ... This is a FAQ, ... If you have to do this kind of operation frequently and don't care about ... database system or any other existing lib that'll ...
    (comp.lang.python)
  • Re: missing new orleans /ner
    ... Tommy: ... alt.usenet.kooks award-winners and FAQ: ... Prev by Date: ...
    (rec.arts.poems)
  • Re: [patch 25/29] xen: Add the Xen virtual network device driver.
    ... Cute. ... but it doesn't yield an obvious improvement: ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)

Loading