Hello!
I want to know if it's guaranteed that a bool that is true always converts into 1 when cast to an int, in C++.
Example:
So can I be sure that the result always will be 21 in this case regardless which compiler?
I'm a bit worried that b might actually get the value 20. Should I stop worrying?
Example:
| Code: |
| int i = 20;
bool b = i; cout << i + b << endl; |
So can I be sure that the result always will be 21 in this case regardless which compiler?
I'm a bit worried that b might actually get the value 20. Should I stop worrying?
