Given code:
int main() { int a = 8; int b = 100; float d; int c = ++a * a++; d = b / (--a); return 0; } but for some reason in g ++ the variable с is equal to 90 , and in msvc it is equal to 81 .
Undefined behavior is classic:
int c = ++a * a++; For C ++ 98:
Double entry in variable a within one point of following.
For C ++ 11:
Violation of the rules of the order of calculation.
The program is erroneous. The compiler may react randomly.
Source: https://ru.stackoverflow.com/questions/523967/
All Articles