GCC 4 出了
從這邊輾轉看到這邊。 然後我就到 GCC 官方網站看 ChangeLog。
比較令我感興趣的有:
- GCC now generates location lists by default when compiling with debug info and optimization. (disabled by
-fno-var-tracking) #pragma pack()semantics have been brought closer to those used by other compilers. This also applies to C++.- ELF visibility attributes can now be applied to a class type, so that it affects every member function of a class at once, without having to specify each individually:
class __attribute__ ((visibility("hidden"))) Foo{ int foo1(); void foo2();};The syntax is deliberately similar to the
__declspec()system used by Microsoft Windows based compilers, allowing cross-platform projects to easily reuse their existing macro system for denoting exports and imports. By explicitly marking internal classes never used outside a binary as hidden, one can completely avoid PLT indirection overheads during their usage by the compiler. You can find out more about the advantages of this at http://people.redhat.com/drepper/dsohowto.pdf - The
-fvisibility-inlines-hiddenoption has been added which marks all inlineable functions as having hidden ELF visibility, thus removing their symbol and typeinfo from the exported symbol table of the output ELF binary. Using this option can reduce the exported symbol count of template-heavy code by up to 40% with no code change at all, thus notably improving link and load times for the binary as well as a reduction in size of up to 10%. Also, check the new -fvisibility option. - Declaration of nested classes of class templates as friends are supported:
template <typename T> struct A { class B {};};class C { template <typename T> friend class A<T>::B;};This complements the feature member functions of class templates as friends introduced in GCC 3.4.0.
- A large subset of the features in Technical Report 1 (TR1 for short) is experimentally delivered (i.e., no guarantees about the implementation are provided. In particular it is not promised that the library will remain link compatible when code using TR1 is used):
- General utilities such as
reference_wrapperandshared_ptr. - Function objects, i.e.,
result_of,mem_fn,bind,function. - Support for metaprogramming.
- New containers such as
tuple,array,unordered_set,unordered_map,unordered_multiset,unordered_multimap. - The
-fvisibilityoption has been added which allows the default ELF visibility of all symbols to be set per compilation and the new#pragmaGCC visibility preprocessor command allows the setting of default ELF visibility for a region of code. Using-fvisibility=hiddenespecially in combination with the new-fvisibility-inlines-hiddencan yield substantial improvements in output binary quality including avoiding PLT indirection overheads, reduction of the exported symbol count by up to 60% (with resultant improvements to link and load times), better scope for the optimizer to improve code and up to a 20% reduction in binary size. Using these options correctly yields a binary with a similar symbol count to a Windows DLL. Perhaps more importantly, this new feature finally allows (with careful planning) complete avoidance of symbol clashes when manually loading shared objects withRTLD_GLOBAL, thus finally solving problems many projects such as python were forced to useRTLD_LOCALfor (with its resulting issues for C++ correctness). You can find more information about using these options at http://gcc.gnu.org/wiki/Visibility.
為了 programmer 的方便,看來各廠的 non-standard feature 的 syntax 會逐漸靠攏。另外,Boost 的一堆好用的東西,也開始進入 GCC 了,GCC 率先準備步入 C++0x 時代。



Post a Comment