1
0

Value of variables in expression order guaranteed.

This commit is contained in:
Captain ALM 2022-08-15 12:49:34 +01:00
parent c8b2296bdd
commit c904f740b7
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1

View File

@ -11,6 +11,11 @@ int getValue()
int main()
{
std::cout << getValue() + (getValue() * getValue()); // a + (b * c)
int a{ getValue() };
int b{ getValue() };
int c{ getValue() };
std::cout << a + (b * c); // order of eval doesn't matter now
return 0;
}