A simple program:Compiling as C gives no errors and no warnings.Compiling as C++ gives a warning:In both cases variable i seems to be 0, although in c++ it could be uninitialized. I actually made such a typo in one of my functions and it was quite hard to find it....
I am using the intel c++ compiler icc version 18.0.3. If I compile the following code with -w3 test_w3.cpp(6): remark #383: value copied to temporary, reference to temporary used vec.push_back(2);
After trying to delve a bit into the mechanics behind cases such as this question brings into light, I still don't understand why the third line in the code below generates only a warning while the second line is an error.
I have a C++ learning demo here: The compiler warnings:Can anyone explain this to me? How to fix it?