Compiler warnings are messages produced by a compiler regarding program code fragments to be considered by the developer, as they may contain errors. Unlike compilation errors, warnings don't interrupt the compilation process. They are not errors from the viewpoint of a programming language, but they may be software bugs. However, many compilers can be customized so that their warnings don't stop the compilation process.
Warnings must not be ignored. You'd better fix every possible error before starting software testing. You may waste much time and effort to find an error in the debugger, although the compiler gives you an explicit warning about it. You should try to eliminate all the warnings or at least to have as few as possible of these while working on the project. The fewer warnings, the easier it is to find an error in new code.
Static code analysis performed at the compilation stage underlies the mechanism of warning generation in various compilers. That's why warnings generated by MSVC, or GCC, or Clang may be different. Unfortunately, the compiler is not capable of carrying out a full-blown analysis, since compilation is meant to be a fast process. That's why one should rather use specialized static analysis tools to search for more complex issues in code.
You can manage the mechanism of warning generation in MSVC by using the '#pragma warning' directive. Thus, if the compiler generates a warning for a correct code or this code is located inside a library, you can suppress its output by using the directive '#pragma warning (disable : X)', where 'X' is the warning number. To turn off the warning output in a certain program fragment, you may do the following:
#pragma warning(push) #pragma warning(disable : X) ....correct code triggering the warning X.... #pragma warnin(pop)