i...@adari.net writes:

> 1. It is wise then to insure that the final value of an expression is 
> ascertained upfront before it is being used in a function call as an
> argument. I suppose this is applicable in all cases of expressions
> and not limited to pre and post increments, although, pre and post
> is where there is likely to be surprises.
>
> 2. Is this the case for C alone, or all major programming languages
> (C++, Java, etc) deal with the argument expressions of a function
> the same way? 
>
> 3. What about the scripting languages perl, php, python, etc?

These questions should really go to the mailing list
gcc-h...@gcc.gnu.org, not to g...@gcc.gnu.org.  Please take any followups
to gcc-help.  Thanks.

1. The rule in C/C++ is that you should only change a variable once
during a single statement, and you should not make any assumptions about
whether that variable is changed before or after other variables changed
in the same statement.  Or, in other words, C/C++ is defined in terms of
sequence points.

2. C and C++ are the same in this regard.  Java defines expression
evaluation as occurring strictly from left to right, so there is no
possible confusion in Java.

3. I don't know.  I recommend reading the appropriate manuals or asking
on the appropriate mailing lists.

Ian

Reply via email to