标题: gcc4.3.0发布,changes部分内容翻译
性别:未知-离线 Maxwell

代王
监管使
枢密直学士
山南西道节度使

Rank: 27Rank: 27Rank: 27Rank: 27Rank: 27Rank: 27
柱国(正二品)
组别 诸侯
级别 征东将军
好贴 4
功绩 1845
帖子 5800
编号 622
注册 2004-7-7


发表于 2008-3-19 15:53 资料 文集 短消息 只看该作者
gcc4.3.0发布,changes部分内容翻译

转载请注明 轩辕春秋 设计与修改区 Maxwell 谢谢合作

2008-03-06发布了gcc4.3.0,用了一下感觉还是值得升级的。因为我只关心C/C++,所以只翻译了changesC/C++相关的部分,有不准确的地方欢迎指正。有时间我会继续翻译更多的内容,也欢迎有兴趣的朋友一起翻译。

gcc首页 http://gcc.gnu.org/
gcc4.3.0 changes地址 http://gcc.gnu.org/gcc-4.3/changes.html



New Languages and Language specific improvements

        We have added new command-line options -finstrument-functions-exclude-function-list and -finstrument-functions-exclude-file-list. They provide more control over which functions are annotated by the -finstrument-functions option.

新增两个命令行选项-finstrument-functions-exclude-function-list和-finstrument-functions-exclude-file-list,这两个选项可以为命令行选项-finstrument-functions提供更多的控制。
(-finstrument-functions用来在函数进入和退出时调个hook函数,一般水平下用不到)
       
C family

        Implicit conversions between generic vector types are now only permitted when the two vectors in question have the same number of elements and compatible element types. (Note that the restriction involves compatible element types, not implicitly-convertible element types: thus, a vector type with element type int may not be implicitly converted to a vector type with element type unsigned int.) This restriction, which is in line with specifications for SIMD architectures such as AltiVec, may be relaxed using the flag -flax-vector-conversions. This flag is intended only as a compatibility measure and should not be used for new code.

现在只有两个内置数组大小相同、元素类型相容时才允许进行隐式类型转换。(注意是“相容”元素类型而不是可隐式类型转换的元素类型,因此int型数组不能隐式转换为unsigned int型数组。)这种限制符合SIMD架构(如AltiVec)的要求,如果要取消这种限制可以使用-flax-vector-conversions参数。这个选项仅用于兼容旧代码,不要用于新代码中。
(暂时没有想起来什么时候进行数组间的隐式类型转换,函数参数中?)

-Warray-bounds has been added and is now enabled by default for -Wall . It produces warnings for array subscripts that can be determined at compile time to be always out of bounds. -Wno-array-bounds will disable the warning.

加入-Warray-bounds选项,使用-Wall时该选项也包含在内。设置该选项后编译期能够检测出的总是越界的数组下标将会产生一个警告。-Wno-array-bounds禁用该警告。

The constructor and destructor function attributes now accept optional priority arguments which control the order in which the constructor and destructor functions are run.

(难道是ObjectiveC中的特性?)

New command-line options -Wtype-limits, -Wold-style-declaration, -Wmissing-parameter-type, -Wempty-body, -Wclobbered and -Wignored-qualifiers have been added for finer control of the diverse warnings enabled by -Wextra.

增加了新的命令行选项-Wtype-limits、-Wold-style-declaration、-Wmissing-parameter-type、-Wempty-body、-Wclobbered和-Wignored-qualifiers。-Wextra选项能够进行多项警告,新增的选项对各项警告进行更细致的控制。

A new function attribute alloc_size has been added to mark up malloc style functions. For constant sized allocations this can be used to find out the size of the returned pointer using the __builtin_object_size() function for buffer overflow checking and similar. This supplements the already built-in malloc and calloc constant size handling.

新增一个新的函数属性alloc_size用于标记malloc风格的函数。这样编译器会记录调用函数时指定的值作为返回指针指向内存的大小,可以用__builtin_object_size()函数获得这个值以进行缓冲区溢出检查或者其他类似操作。malloc和calloc已经使用了这个属性。

Integer constants written in binary are now supported as a GCC extension. They consist of a prefix 0b or 0B, followed by a sequence of 0 and 1 digits.

GCC扩展支持用二进制格式书写整型常量。格式是0b/0B前缀后加0/1序列。

A new predefined macro __COUNTER__ has been added. It expands to sequential integral values starting from 0. In conjunction with the ## operator, this provides a convenient means to generate unique identifiers.

新增一个预定义宏__COUNTER__。这个宏的展开为一个整型值(从0开始)。在与##操作符一起使用时,可以方便地生成唯一标识符。

A new command-line option -fdirectives-only has been added. It enables a special preprocessing mode which improves the performance of applications like distcc and ccache.

新增命令行选项-fdirectives-only。它使用一种特殊的预处理模式可以改善像distcc和ccache这样的应用的性能。
(distcc用于分布式编译,ccache的作用类似于预编译头文件)

Fixed-point data types and operators have been added. They are based on Chapter 4 of the Embedded-C specification (n1169.pdf). Currently, only MIPS targets are supported.

(仅MIPS目标机支持,忽略之。)

C++

        Experimental support for the upcoming ISO C++ standard, C++0x.

实验性支持C++0x
(原来说C++07差不多,现在看来又跳票了,看看跟暴雪谁跳的厉害)

-Wc++0x-compat has been added and is now enabled by default for -Wall. It produces warnings for constructs whose meaning differs between ISO C++ 1998 and C++0x.

新增-Wc++0x-compat选项,在-Wall中已经启用。如果代码在C++98和C++0x间有所不同将会产生警告。

The -Wparentheses option now works for C++ as it does for C. It warns if parentheses are omitted when operators with confusing precedence are nested. It also warns about ambiguous else statements. Since -Wparentheses is enabled by -Wall, this may cause additional warnings with existing C++ code which uses -Wall. These new warnings may be disabled by using -Wall -Wno-parentheses.

选项-Wparentheses现在在C++中作用与C中一致。如果在不同优先级的运算符混用时省略括号,将会产生警告。二义性的else语句也会产生警告。-Wparentheses已经包含在-Wall中,这会导致一些原有的使用-Wall编译的代码产生新的警告,使用-Wall -Wno-parentheses屏蔽这些警告。

The -Wmissing-declarations now works for C++ as it does for C.

选项-Wmissing-declarations现在在C++中作用与C中一致。

The -fvisibility-ms-compat flag was added, to make it easier to port larger projects using shared libraries from Microsoft's Visual Studio to ELF and Mach-O systems.

新增-fvisibility-ms-compat选项,用于将使用共享库的项目从MSVS移植到ELF和Mach-O中。
(ELF是unix和linux系统下的可执行文件格式)

C++ attribute handling has been overhauled for template arguments (ie dependent types). In particular, __attribute__((aligned(T))); works for C++ types.

仔细检查了用于模板参数的C++属性的使用(如依赖的类型)。特别是__attribute__((aligned(T)));用于C++类型时。

Runtime Library (libstdc++)

        Experimental support for the upcoming ISO C++ standard, C++0x.

实验性支持C++0x

Support for TR1 mathematical special functions and regular expressions. The implementation status for TR1 can be tracked in tr1.html  

支持TR1数学函数和正则表达式。
(这个翻译的估计不对,与网站上列出的TR1的状态不符。还是自己装boost吧。)

Default what implementations give more elaborate exception strings for bad_cast, bad_typeid, bad_exception, and bad_alloc.

bad_cast、bad_typeid、bad_exception和bad_alloc异常给出更详细的异常字符串。

Header dependencies have been streamlined, reducing unnecessary includes and pre-processed bloat.

调整头文件依赖关系,减少不必要的include和预处理操作。

Variadic template implementations of items in <tuple> and <functional>.

用可变参数模板实现<tuple>和<functional>中的部分内容。
(tuple和functional是两个头文件。)

An experimental parallel mode has been added. This is a parallel implementation of many C++ Standard library algorithms, like std::accumulate, std::for_each, std::transform, or std::sort, to give but four examples. These algorithms can be substituted for the normal (sequential) libstdc++ algorithms on a piecemeal basis, or all existing algorithms can be transformed via the -D_GLIBCXX_PARALLEL macro.

新增一种实验性的并行模式。它可以并行执行很多C++标准库算法,像std::accumulate、std::for_each、std::transform、std::sort之类。这些算法可以单个替换常规的(串行的)libstdc++算法,也可以使用-D_GLIBCXX_PARALLEL宏一次替换所有现存的算法。

Debug mode versions of classes in <unordered_set> and <unordered_map>.

<unordered_set>和<unordered_map>中的类增加Debug版。

Formal deprecation of <ext/hash_set> and <ext/hash_map>, which are now <backward/hash_set> and <backward/hash_map>. This code:     #include <ext/hash_set>
            __gnu_cxx::hash_set<int> s;
            Can be transformed (in order of preference) to:     #include <tr1/unordered_set>
            std::tr1::unordered_set<int> s;
            or     #include <backward/hash_set>
            __gnu_cxx::hash_set<int> s;
            Similar transformations apply to __gnu_cxx::hash_map, __gnu_cxx::hash_multimap, __gnu_cxx::hash_set, __gnu_cxx::hash_multiset.

废弃<ext/hash_set>和<ext/hash_map>,改为<backward/hash_set>和<backward/hash_map>。
代码
#include <ext/hash_set>
    __gnu_cxx::hash_set<int> s;
可以改为(根据喜好):
#include <tr1/unordered_set>
std::tr1::unordered_set<int> s;
或者
#include <backward/hash_set>
__gnu_cxx::hash_set<int> s;

__gnu_cxx::hash_map、__gnu_cxx::hash_multimap、__gnu_cxx::hash_set、__gnu_cxx::hash_multiset也是同样转换。


附件: gcc4_3_0.zip (2008-3-19 15:53, 8.13 K)
该附件被下载次数 257


顶部

正在浏览此帖的会员 - 共 2 人在线




当前时区 GMT+8, 现在时间是 2025-2-5 14:02
京ICP备2023018092号 轩辕春秋 2003-2023 www.xycq.org.cn

Powered by Discuz! 5.0.0 2001-2006 Comsenz Inc.
Processed in 0.012258 second(s), 11 queries , Gzip enabled

清除 Cookies - 联系我们 - 轩辕春秋 - Archiver - WAP