Same code and different result, Why?
- From: Lorry Astra <LorryAstra@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Nov 2008 23:50:05 -0800
Code:
#include <stdio.h>
int main()
{
int x = 36, y = 20;
x = x++ + y++;
y = ++x + ++y;
printf("x value is %d, y value is %d \n",x,y);
return 1;
}
I compile this code in different compilor with different CPU.
In x86 I get : x value is 58, y value is 80, while in other two processors,
the result is "x value is 57, y value is 79".
Is this realated with compilor or CPU achitechure? Why?
Thanks.
.
- Follow-Ups:
- Re: Same code and different result, Why?
- From: Alex Blekhman
- Re: Same code and different result, Why?
- From: Ulrich Eckhardt
- Re: Same code and different result, Why?
- Prev by Date: Re: using const & in function prototypes
- Next by Date: Re: using const & in function prototypes
- Previous by thread: using const & in function prototypes
- Next by thread: Re: Same code and different result, Why?
- Index(es):