...
Code Block | ||
---|---|---|
| ||
int test (int x) {
x--;
if (x < 0 || x > 10) {
return 0;
}
else {
static int y = test(x); //<--undefined behavior occurs here
return y;
}
}
|
...
Code Block | ||
---|---|---|
| ||
int test (int x) {
x--;
if (x < 0 || x > 10) {
return 0;
}
else
{
static int y;
y = test(x);
return y;
}
}
|
...