What will happen when you execute this code snippet?
#include <iostream>
int main() {
float a = 5.51;
int b = static_cast<int>(a);
std::cout << b;
}
Correct answer is:
5 will be printed on standard output, with no compilation warnings generated.
But for me would make more sense to generate compilation warning as precision would be lost. Why not?