Is there a -pedantic equivalent for gcc when using the Microsoft Visual C ++ compiler?

I want my alerts to be set to the highest level using the Microsoft Visual C ++ Compiler. Similar to using -pedantic in gcc. What compiler keys do you use to enable most warnings?

+6
compiler-warnings visual-c ++
source share
5 answers

The highest warning level in Visual C ++ is / Wall. The alert level can also be set numerically with / W 0, / W1, ... / W4 to generate increasing alert levels.

The compiler will also check for 64-bit portability issues with / Wp 64.

And you can say that it treats warnings as errors using / wx

Visual C ++ doesn't seem to have the real equivalent of -pedantic - which asks gcc to report all warnings that should be reported by the ISO C and C ++ standards.

+8
source share

AS mentioned billmcc64 , gcc -patent reasons gcc warns if you use any non-standard extensions. I do not think that you can force MSVC to warn about a similar situation, but you can force it to generate an error for these situations using the / Za switch.

+4
source share

Please note that / Wp 64 is not recommended by Microsoft, as opposed to compiling directly for a 64-bit platform, if possible.

Also note that the Team Developer version has the / analysis option, which adds semantic checking for common code errors. You can also see how to get PC-lint from gimpel for additional semantic verification.

+2
source share

if you want something like an epidemic, try a good lint like pc-lint ( http://www.gimpel.com/html/products.htm ).

+2
source share

/W4 /Wall should do the trick.

+1
source share

All Articles