mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 15:08:52 +00:00
- Stop calculating operands for & operators. - Evaluate the lhs of compound operators only once. - Add `side-effect.c` example.
14 lines
143 B
C
14 lines
143 B
C
int g = 0;
|
|
|
|
int* foo() {
|
|
g += 10;
|
|
return &g;
|
|
}
|
|
|
|
int main() {
|
|
// `foo()` should be called once.
|
|
*&*foo() += 1;
|
|
|
|
return g;
|
|
}
|