User account creation filtered due to spam.
the ternary operator causes incrementation of left hand side expression to occurs before it should in an expression where the variable appears at both side of the affectation expression.
example: *s++ = (*s == 'x') ? 'X': *s;
Note: this does not appears in gcc-2.96 (Mandrake 8.2)
gcc 2.95.2 - gcc 2.95.3 - gcc 3.04
gcc 2.95.3, gcc 3.04 (home compiled on Linux Mandrake 8.1)
Mac OS X : gcc 2.95.2
#define STRING "abc"
char s, *t;
t = s;
while (*t != '\0')
*t++ = (*t == 'b') ? 'X': *t;
/* this print "Xc" instead of "aXc" */
Must replace ternary operator by if/else instruction
State-Changed-Why: Not a bug. The standard states that whether the LHS or the RHS of '=' is evaluated first is undefined. You were lucky before.
Reopening to ...
a dup of bug 11751
*** This bug has been marked as a duplicate of 11751 ***