In C the following horror is valid:
myFunc()
{
return 42; // return type defaults to int.
}
But, what about in C++? I can't find a reference to it either way...
My compiler (Codegear C++Builder 2007) currently accepts it without warning, but I've had comments that this is an error in C++.
It's ill-formed in C++. Meaning that it doesn't compile with a standard conforming compiler. Paragraph 7.1.5/4 in Annex C of the Standard explains the change "Banning implicit int".
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