什么是默认的C模式目前海湾合作委员会(尤其是在Ubuntu)? [英] What is the default C mode for the current gcc (especially on Ubuntu)?

查看:173
本文介绍了什么是默认的C模式目前海湾合作委员会(尤其是在Ubuntu)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我问问看CC的当前版本我得到这个。

When I ask to see the current version of cc I get this.

$ cc --version
cc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ 

我想知道的是,如果C89,正在使用C90,C99或C11。

What I would like to know is if c89, c90, c99 or c11 is being used.

推荐答案

这是深入键入解释在GCC手册,使用(如果它安装)信息GCC 或在线这里。 4.7.2该手册的相关部分这里

This is explained in depth in the gcc manual, available (if it's installed) by typing info gcc or online here. The relevant section of the 4.7.2 manual is here.

在默认情况下,海湾合作委员会不​​符合任何的ANSI / ISO C标准。当前默认等同于 -std = gnu90 ,这是1989/1990标准与特定的GNU的扩展。 (由语言标准所要求的一些诊断都没有发出。)5.1.0版本,发布了2015年4月22日,更改了默认的 -std = gnu90 -std = gnu11 因为这里记录。

By default, gcc does not conform to any of the ANSI/ISO C standards. The current default is equivalent to -std=gnu90, which is the 1989/1990 standard with GNU-specific extensions. (Some diagnostics required by the language standard are not issued.) Version 5.1.0, released 2015-04-22, changed the default from -std=gnu90 to -std=gnu11, as documented here.

如果您希望符合标准,你可以使用任何如下:

If you want standard conformance, you can use any of the following:

-std=c90 -pedantic
-std=c99 -pedantic
-std=c11 -pedantic

-std = C90 也可以拼写 -ansi -std = C89 -std = iso9899:1990

-std = iso9899:199409 支持C90标准以及1995年的修订,其中增加了一些小功能(所有这一切也是C99)

-std=iso9899:199409 supports the C90 standard plus the 1995 amendment, which added a few minor features (all of which are also in C99).

-std = C99 也可以拼写 -std = C9X -std = iso9899:1999 (名字 C9X 使用了标准发布之前)。 C99支持不够全面,但已经很接近了。

-std=c99 can also be spelled -std=c9x or -std=iso9899:1999 (the name c9x was used before the standard was published). C99 support is not quite complete, but it's close.

-std = C11 也可以拼写 -std = C0X -std = iso9899:2011 (名字 C0X 最终标准发布之前使用;有人错误地认为 X 将不超过9)。 C11支持也是不完整的;目前的状况是这里总结

-std=c11 can also be spelled -std=c0x or -std=iso9899:2011 (the name c0x was used before the final standard was published; it was wrongly assumed that x would not exceed 9). C11 support is also incomplete; the current status is summarized here.

-pedantic 选项会使GCC打印所需的诊断对违反限制和语法规则的。在某些情况下,这些诊断仅仅是警告 - 有没有简单的方法那些不是由语言需要警告和警告等区分。替换 -pedantic -pedantic-错误来导致GCC把语言作为侵犯致命错误。

The -pedantic option causes gcc to print required diagnostics for violations of constraints and syntax rules. In some cases, those diagnostics are merely warnings -- and there's no easy way to distinguish between those warnings and other warnings that aren't requires by the language. Replace -pedantic by -pedantic-errors to cause gcc to treat language violations as fatal errors.

标准的快速病史:


  • C89是第一个正式的C标准,由 ANSI 于1989年出版。

  • C90是 ISO 版标准,描述完全相同的语言C89 。 ANSI正式通过ISO的标准版本。有两个技术勘误,纠正了一些错误。

  • C95是一项修正案,C90,增加了一些功能,主要有向图和宽字符支持。据我所知,合并版本是从来没有出版。

  • C99是由ISO颁布于1999年有三个技术勘误。

  • C11是由ISO于2011年颁布已经有一个技术勘误表,固定 __ STDC_VERSION __ 的定义和 __ STDC_LIB_EXT1 __

  • C89 was the first official C standard, published by ANSI in 1989.
  • C90 was the ISO version of the standard, describing exactly the same language as C89. ANSI officially adopted ISO's version of the standard. There were two Technical Corrigenda, correcting some errors.
  • C95 was an amendment to C90, adding a few features, mainly digraphs and wide character support. As far as I know, a merged version was never published.
  • C99 was issued by ISO in 1999. There were three Technical Corrigenda.
  • C11 was issued by ISO in 2011. There has been one Technical Corrigendum, fixing the definitions of __STDC_VERSION__ and __STDC_LIB_EXT1__.

ANSI没有发出自己的1999年或2011年的标准版本,采用ISO标准来代替。

ANSI did not issue its own versions of the 1999 or 2011 standards, adopting the ISO standards instead.

N1256 是免费提供的草案C99标准,用3个技术勘误合并到它。

N1256 is a freely available draft of the C99 standard, with the 3 Technical Corrigenda merged into it.

N1570 是免费提供的草案的C11标准。还有它和公布的标准C11,还有一个技术勘误之间有一些细微的差别。有关详细信息,请参见我的回答来的这个问题

N1570 is a freely available draft of the C11 standard. There are some minor differences between it and the published C11 standard, plus one Technical Corrigendum. For more details, see my answer to this question.

这篇关于什么是默认的C模式目前海湾合作委员会(尤其是在Ubuntu)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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