The snippet you have provided above invokes undefined behavior. According to C standard
C11: 6.5 Expressions:
If a side effect on a scalar object is unsequenced relative to either a different side effect on the same scalar object or a value computation using the value of the same scalar object, the behavior is undefined. If there are multiple allowable orderings of the subexpressions of an expression, the behavior is undefined if such an unsequenced side effect occurs in any of the orderings.84).
In the expression *p0++ = mult(*p0, psign[i1])
, the modification to p0
on left side of the assignment operator is not sequenced before or after the use of p0
on right hand side of the expression. Therefore, the snippet
*p0++ = mult(*p0, psign[i1]);
is not equivalent to
*p0 = mult(*p0, psign[i1]);
p0++; // Side effect to p0 is guaranteed after the use
// of p0 in mult function
p0
will be the return ofmult()
and then incremented. – Sideslipmult()
a macro here? – Paphian