Are there any guarantees when modifying arguments during method invocation?-Collection of common programming errors
In Java when passing arguments to a method and modifying the passed arguments during the method call is it guaranteed that the result is what is expected? E.g.
a.method(++i);
etc
Is it guaranteed for instance that inside method
the variable i
will have the updated value?
Or a.method(i++)
Will method
get the value of i
after incrementing or before?
Also same for all similar cases.
I kind of remember this is forbidden in C++ as implementation specific but perhaps I remember wrong.