To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (an extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
USD
EUR
RUB
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
>
Compiler warnings

Compiler warnings

Apr 05 2013

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)

References

Comments (0)

Next comments
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept