I'm compiling my C++ application using icc v. 12, and enabled all warnings to see what the Intel compiler would say about my code. I've got warnings, of course, but some of them didn't make a lot of sense. For example,
warning #2022: Effective C++ Item 12 field member "numeric_kernel::b" not initialized (preferable to assignment in constructors)
For one variable that will be initialized inside the constructor because some calculation has to be done before it is assigned.
warning #2012: Effective C++ Item 1 prefer const and inline to #define
where the #define clearly refers to a definition of a .h file.
The last one,
remark #383: value copied to temporary, reference to temporary used
return -Q * z * exp(-I*angle);
inside a class method, where all the variables are members of the class. Can it be just compiler noise?
As far as the effective C++ warnings are concerned thesewarnings about things that are sometimes bad programming practice according to Scott Meyer's "Effective C++" book. Seeing a warning here doesn't mean the code isactually bad. I'm sure you'd see similar warnings if you used the -Weffc++ switch with the Gnu compiler.It is not possible for a compilerto get these exactly right, i.e. only issue the warnings on actual bad code.
If they seem to not be useful you should not use the -Weffc++ switch or you can disable the diagnosticsindividually.
The #383 remark is explained in our knowledge base here: