C
Christoph Rabel
Hi!
When compiling the following program in release mode I get
as output:
22
#include <iostream>
using namespace std;
int f() {
static int i;
return ++i;
}
int main()
{
cout << f() << f() << "\n";
}
Now, while I know, that the order of evaluation is
unspecified I think that the output 22 is clearly wrong.
In my humble opinion it should be either 21 or 12.
Is this a bug?
Christoph
When compiling the following program in release mode I get
as output:
22
#include <iostream>
using namespace std;
int f() {
static int i;
return ++i;
}
int main()
{
cout << f() << f() << "\n";
}
Now, while I know, that the order of evaluation is
unspecified I think that the output 22 is clearly wrong.
In my humble opinion it should be either 21 or 12.
Is this a bug?
Christoph