I would like to have my warnings set to the highest level using Microsoft Visual C++ compiler. Similar to using -pedantic on gcc. What compiler switches do you use to have the most warnings enabled?
Checkout the new /permissive-
option which is supported in Visual Studio 2017 and later. The /permissive-
option is compatible with almost all of the header files from the latest Windows Kits, such as the Software Development Kit (SDK) or Windows Driver Kit (WDK), starting in the Windows Fall Creators SDK (10.0.16299.0). Older versions of the SDK may fail to compile under /permissive-
for various source code conformance reasons.
There is also the /Za
option for disabling all the language extensions, but this also causes compilation errors when header files from the Windows Kits are used (such as winnt.h and winioctl.h). So, this option is not really viable.
See: https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance
The highest warning level on Visual C++ is /Wall. The warning level can also be set numerically with /W0, /W1, ... /W4 to generate increasing levels of warnings.
The compiler will also check for 64 bit portability issues with /Wp64.
And you can tell it to treat warnings as errors with /WX
Visual C++ doesn't seem to have an real equivalent to -pedantic - which is asking gcc to report all warnings required to be reported by the ISO C and C++ standards.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With