gcc 信息页面中的“-std=standard”是什么意思?

what does "-std=standard" in gcc info page mean?

我想知道我目前安装的gcc默认遵循什么C语言标准。我 运行 info gcc 它给出了 -std=standard.

-std=standard 是什么意思?

我期待 -std=gnu11

OS: linux 薄荷 19.1 海湾合作委员会版本:7.4.0, gcc 预装了 OS

我在这里查看了在线手册: https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gcc/Standards.html#C-Language

但我没有找到任何名为 "standard" 的默认标准。相反,我发现它应该是 "gnu11"

信息 gcc 响应:

...
OPTIONS
   Option Summary
       Here is a summary of all the options, grouped by type.  Explanations
       are in the following sections.

       Overall Options
           -c  -S  -E  -o file  -x language -v  -###  --help[=class[,...]]
           --target-help  --version -pass-exit-codes  -pipe  -specs=file
           -wrapper @file  -fplugin=file  -fplugin-arg-name=arg
           -fdump-ada-spec[-slim]  -fada-spec-parent=unit  -fdump-go-spec=file

       C Language Options
           -ansi  -std=standard  -fgnu89-inline
           -fpermitted-flt-eval-methods=standard -aux-info filename
           -fallow-parameterless-variadic-functions -fno-asm 
...

单词"standard"是草书字体。这是一个模板,它不是 "default gcc standard gcc uses by default",它是一个由用户使用可用选项填充的模板,单词 "standard" 代表 gnu11c11 或您要指定的标准。

-fpermitted-flt-eval-methods=standard 或 -fno-builtin-function 也是如此。您应该指定 gcc 不应使用内置函数的 function。这是 gcc 中 C 语言的可用选项列表,而不是 gcc 使用的默认选项列表。

您可以通过检查 __STDC_VERSION__ 宏找到正在使用的标准 gcc。或者检查documentation。引用 link,对于 gcc 7.2.0:

The default, if no C language dialect options are given, is -std=gnu11.

-std=standard 的上下文中,standard 表示 Options Controlling C Dialect 中列出的值之一。它并不意味着字面意思是字符串 standard;导致错误:

gcc: error: unrecognized command line option ‘-std=standard’