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

时间:2019-08-23 22:30:33

标签: c gcc linux-mint

我想知道默认情况下我当前安装的gcc是什么C语言标准。我运行了info gcc,它给了-std=standard

-std=standard是什么意思?

我期待的是类似-std=gnu11

操作系统:linux mint 19.1 gcc版本:7.4.0, gcc预先安装了操作系统

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

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

info 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 
...

2 个答案:

答案 0 :(得分:2)

“标准”一词是草书字体。这是一个模板,不是“默认情况下gcc默认使用的默认gcc标准”,它是由用户使用可用选项填充的模板,“ standard”一词代表gnu11c11或您要指定的标准。

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

您可以通过检查__STDC_VERSION__宏来找到正在使用的标准gcc。或检查documentation。为gcc 7.2.0引用链接:

  

如果未提供C语言方言选项,则默认值为-std = gnu11。

答案 1 :(得分:1)

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

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