加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – g版本4.0.0.8和4.3.2之间有什么区别?

发布时间:2020-12-16 05:50:57 所属栏目:百科 来源:网络整理
导读:g 4.0.0.8和g 4.3.2有什么区别?这两个是我在各种编程竞赛中看到的最常见的C编译器. 我试着谷歌,但没有发现任何东西. 解决方法 考虑到你对两者之间的C变化感兴趣,这真的不是一个“巨大的列表”. 4.0.0.8只是4.0的补丁修订版,其发行说明如下:http://gcc.gnu.
g 4.0.0.8和g 4.3.2有什么区别?这两个是我在各种编程竞赛中看到的最常见的C编译器.

我试着谷歌,但没有发现任何东西.

解决方法

考虑到你对两者之间的C变化感兴趣,这真的不是一个“巨大的列表”.

4.0.0.8只是4.0的补丁修订版,其发行说明如下:http://gcc.gnu.org/gcc-4.0/changes.html

4.3.2是4.3的补丁修订版,其发行说明如下:http://gcc.gnu.org/gcc-4.3/changes.html

如果你看看它们之间的差异,我认为以下列表涵盖了你真正关心的GCC 4.0和4.3之间最重要的区别.

GCC 4.3.2(包括GCC 4.1和GCC 4.2的变化):

Experimental support for the ISO C++0x standard(这是一个链接)

> long long现在已经在C中正式支持(尽管它是旧版GCC提供的扩展)
>支持模板extern
>你在std :: vector< std :: vector< int>>中看到的直角括号现在支持(请注意声明末尾两个>之间缺少空格).
> experimental support for Variadic Template Arguments
> Static assertions
>和其他一些人

更多TR1库支持

>< regex> (gcc 4.3),< random> (gcc 4.2)和< complex> (gcc 4.2)

C能见度处理已经彻底改变. (GCC 4.2)

Restricted visiblity is propagated from classes to members,from functions to local statics,and from templates and template arguments to instantiations,unless the latter has explicitly declared visibility.

The visibility attribute for a class must come between the class-key and the name,not after the closing brace.

Attributes are now allowed for enums and elaborated-type-specifiers that only declare a type.

Members of the anonymous namespace are now local to a particular translation unit,along with any other declarations which use them,though they are still treated as having external linkage for language semantics.

在GCC 4.2中删除了未记录的模板扩展(在4.1中已弃用)

The (undocumented) extension which permitted templates with default arguments to be bound to template template parameters with fewer parameters has been removed. For example:

template <template <typename> class C>
void f(C<double>) {}

template <typename T,typename U = int>
struct S {};

template void f(S<double>);

is no longer accepted by G++. The reason this code is not accepted is that S is a template with two parameters; therefore,it cannot be bound to C which has only one parameter.

另外,请查看porting to GCC 4.3 guide,其中一些重要内容如下:

向后兼容/已弃用标头已被删除.

大多数情况下,这意味着已删除了一堆预标准标题,例如< iostream.h> (使用标准< iostream>),< hash_map.h> (使用< tr1 / unordered_map>)< hashtable.h> (根据需要使用< tr1 / unordered_map>或< tr1 / unordered_set>)等.再次,不是什么大不了的事.

更严格的标准执行

例如,main的双参数形式上的签名必须正确.

没有重复的函数参数名称

void func(int x,int x); // now an error

并且有各种错误修复,以及我认为不会真正影响您如何编写竞争代码(如删除/添加新编译器标志)以及删除诸如<?之类的内容的更改.和>?操作符(曾经使用过那些?).

总而言之,如果你不得不为两个编译器编写代码,我不认为这两者之间的差异会让你感到非常悲伤.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读