Consider the following program:
int b(int in)
{
return in + 1;
}
int a(int in)
{
b(in); // return statement forgotten
}
int main()
{
std::cout << "returned: " << a(5) << "\n";
}
VC++ gives an error about the missing 'return'. Intel Compiler only issues a warning (missing return statement at end of non-void function "a") but most surprisingly at runtime the code does return the correct value and the printout is:
returned: 6
How come?
Using Intel C++ compiler 19.0