Why isn't the compiler complaining about this code:
#include <string>
#include <iostream>
int main()
{
std::string a;
a = 2.3;
std::cout << "A:" << a << std::endl;
return 0;
}
GCC, MSVC don't seem to be concerned about this at all, even though it is clearly wrong and doesn't actually work anyway!
The output is:
A:
OUCH ! Lead to an undetected error in my program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With