On Apr 23, 2:08 pm, Bob Woodham <[EMAIL PROTECTED]> wrote:

> x = x++;
>
> has unspecified behaviour in C.  That is, it is not specified
> whether the value of x after execution of the statement is the
> old value of x or one plus the old value of x.

unspecified means that the result could be anything: old value, old
value+1, -2993882, "trallalla", core dump, stack overflow etc...

in Java the behavior is specified, but many might find the result
counterintuitive:

int x = 0;
x = x++;
System.out.println(x);

prints 0, if I recall it correctly the ++ mutates after the assignment
takes place, therefore it increments the old value that then summarily
discarded.

i.


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to