天天看點

C++的價值

In May 2010, the GCC steering committee decided to allow use of a C++ compiler to compile GCC. The compiler was intended to be written in C plus a subset of features from C++. In particular, this was decided so that GCC's developers could use the destructors and generics features of C++

從GCC的觀點來看,C++最有價值的部分,是析構函數和泛型。

析構函數是最直接的資源管理方法,也是最直接的scope工具;基于析構函數可以做出很多有價值的設計。

泛型是大型程式設計語言的必需品;雖然泛型的使用非常複雜而且易出錯,但是目前來看泛型仍然是實作容器的最佳辦法。業務開發要避開泛型,但是基礎類庫卻又需要泛型。

Bionic lacks many features found in full libc implementations, such as wide character and C++ exception handling support.

從bionic的觀點來看,C++的寬位元組和異常都是毒藥。

寬位元組并不能解決unicode的問題,但是帶來了一堆麻煩,去掉最好。C++的異常,帶來的問題比它解決的問題還多,去掉最好。

轉載于:https://www.cnblogs.com/hehe520/p/6330350.html