Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

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

close form
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

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

close form
check circle
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

Popular related articles


Comments (0)

Next comments next comments
close comment form