什么是GCC / G ++编译器使用-pedantic的目的是什么? [英] What is the purpose of using -pedantic in GCC/G++ compiler?
问题描述
-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标准,
拒绝任何code这是不
兼容。
-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
与GCC / G ++编译器选项,我无法理解上面的描述。谁能告诉我使用上述两个选项的情况下?什么时候应该使用它?它是重要的?
Text above is extract from this note. First thing first, what is the purpose of usage of -pedantic
and -ansi
option with GCC/G++ compiler, I couldn't understand the above description. Can anyone tell me the circumstances of using the above two options? When should I use it? Is it important one?
推荐答案
GCC编译器总是试图编译程序,如果这是在所有可能的。然而,在一些
的情况下,C和C ++标准规定特定扩展名被禁止。标准的编译器
如gcc或g遇到这些扩展名时必须++发出诊断。例如,
gcc编译的-pedantic选项导致GCC发行在这种情况下警告。使用更严格 -pedantic-错误
选项,例如诊断警告转换成会导致编译错误
在这样的点失败。只有那些需要通过一符合的被标记非ISO构建
编译器将生成警告或错误。
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. 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的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!