Is there an equivalent to -pedantic for gcc when using Microsoft's Visual C++ compiler?

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.


AS billmcc64 mentioned, gcc's -pedantic causes gcc to warn if you use any non-standard extensions. I don't think you can get MSVC to warn for a similar situation, but you can cause it to generate an error for these situations using the /Za option.


Note that /Wp64 is not recommended by Microsoft as opposed to compiling directly for the 64-bit platform if possible.

Also note that the Team Developer edition has a /analyze option, which adds semantic checking for common code errors. You can also look at getting PC-lint from gimpel for additional semantic checking.