这篇笔记说:
-ansi
:告诉编译器实现ANSI语言选项.这转关闭某些功能"海湾合作委员会的与 ANSI 不兼容标准.
-ansi
: tells the compiler to implement the ANSI language option. This turns off certain "features" of GCC which are incompatible with the ANSI standard.
-pedantic
:与-ansi
结合使用,告诉编译器严格遵守ANSI标准,拒绝任何不是的代码合规.
-pedantic
: used in conjunction with -ansi
, this tells the compiler to be adhere strictly to the ANSI standard,
rejecting any code which is not
compliant.
第一件事:
-pedantic
和 -ansi
选项的目的是什么(我无法理解上面的描述)?-pedantic
and -ansi
options of the GCC/G++ compiler (I couldn't understand the above description)?如果可能的话,GCC 编译器总是会尝试编译您的程序.然而,在一些在这种情况下,C 和 C++ 标准规定禁止某些扩展.符合标准的编译器遇到这些扩展时,例如 GCC 或 g++ 必须发出诊断信息.
GCC compilers always try to compile your program if this is at all possible. However, in some cases, the C and C++ standards specify that certain extensions are forbidden. Conforming compilers such as GCC or g++ must issue a diagnostic when these extensions are encountered.
例如,GCC 编译器的-pedantic 选项会导致 GCC 在这种情况下发出警告.使用更严格的-pedantic-errors 选项将此类诊断警告转换为将导致编译在此类点失败的错误.只有那些需要由符合标准的编译器标记的非 ISO 构造才会生成警告或错误.
For example, the GCC compiler’s -pedantic option causes GCC to issue warnings in such cases. Using the stricter -pedantic-errors option converts such diagnostic warnings into errors that will cause compilation to fail at such points. Only those non-ISO constructs that are required to be flagged by a conforming compiler will generate warnings or errors.
这篇关于在 GCC/G++ 编译器中使用 -pedantic 的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!