使用Microsoft的Visual C ++编译器时,gcc有与-pedantic等效的功能吗? [英] Is there an equivalent to -pedantic for gcc when using Microsoft's Visual C++ compiler?

查看:73
本文介绍了使用Microsoft的Visual C ++编译器时,gcc有与-pedantic等效的功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用Microsoft Visual C ++编译器将警告设置为最高级别。类似于在gcc上使用-pedantic。您使用哪种编译器开关启用了最多的警告?

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?

推荐答案

Visual C ++上的最高警告级别是/ Wall。警告级别也可以用/W0、/W1、.../W4进行数字设置,以生成不断增加的警告级别。

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.

编译器还将检查64位/ wp64的可移植性问题。

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

您可以告诉它将警告视为/ WX

And you can tell it to treat warnings as errors with /WX

Visual C ++似乎没有真正等同于-pedantic的-它要求gcc报告所有需要由ISO C和C ++标准报告的警告。

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.

这篇关于使用Microsoft的Visual C ++编译器时,gcc有与-pedantic等效的功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆