"X = X++;" in C code results in unexpected behavior
Issue
The C code get a Wsequence-point
warning message below.
$ gcc -Wall sample.c
sample.c: In function ‘main’:
sample.c:7:7: warning: operation on ‘a’ may be undefined [-Wsequence-point]
7 | a = a++;
| ~~^~~~~
What is sequence-point
?
Environment
Red Hat Enterprise Linux 8
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.