C++0x 風暴, 即將來襲
Posted on October 29th, 2008 at 15:49 by fr3@K

今天從 Sutter’s Mill 知道 最新的 C++0x draft (n2798) 已經正式 publish 以被 review 與 comment. Sutter 稱這 draft 為 feature complete.

也是今天, 在 Visual C++ Team Blog 看到 Visual Studio 2010 的 Community Technology Preview (CTP) 版本也 release 了 (按此前往下載頁面. Warning: 11 個 split 過的 rar, 約 7350 MB). 其中最令人興奮的正是對 C++0x 的支持:

  • Lambda Expressions (functional programming 來了, C++ 請接招)
  • Rvalue References (opportunity for major performance boost)
  • void foo()
    {
      list<string> strings;
      // strings.push_back("bar");
      strings.push_back(string("bar"));
    }
    

    這段 code 將只需要兩次 memory allocation, 一次在 list, 一次在 string. 因 "bar" string("bar") (note: see comment from icek) 而產生的 string 暫時物件的 resource 將直接轉移到 list 內部新創建的 element 身上 (move-construct). 不再是把該暫時物件 copy 到新創建的 element 身上 (copy-construct).

    Note: 雖然 VS10 的 C++ compiler 已經支援 Rvalue-References, 但由於 VS10 所 ship 的 STL (by Dinkumware) 尚未實現 Rvalue-References 的部份, 因此, 在 VC10 的 STL 改善之前, 上面的 code snip 仍然會觸發 string 的 copy-construction, 換句話說會引發三次 allocation.

  • static_assert (compile time 即可 assert 的不再需要等到 run time)
  • auto Keyword (懶人好幫手)
  • template <class Container>
    void bar(const Container& cont)
    {
      for(auto first = cont.begin(); first != cont.end(); ++first)
      {
        // do meaningful things here...
      }
    }
    

    別把用在此處的 auto 與 variant 混為一談, 兩者完全不同. 後者 (variant) 的型別 (或者說意義) 是 runtime 決定的 (可參考 Boost.VariantCOM 的 variant). 前者 (auto) 則是在 compile time 就決定了. 簡單的說, 是 compiler 在 compile 時藉由後面的敘述 (例中的 cont.begin()) 推導出 auto 定義的變數 (first ) 的 type.

另外, FOSS 陣營的王道 compiler, GCC, 則是一直有在 C++0x 的支持方面持續加強 (GCC 4.3/4.4). 不過 (就我所知) 還沒進入主流的 GNU/Linux distro.

del.icio.us:C++0x 風暴, 即將來襲 digg:C++0x 風暴, 即將來襲 spurl:C++0x 風暴, 即將來襲 newsvine:C++0x 風暴, 即將來襲 furl:C++0x 風暴, 即將來襲 Y!:C++0x 風暴, 即將來襲 黑米共享書籤:C++0x 風暴, 即將來襲 推推王:C++0x 風暴, 即將來襲
Protected: 今天, 我沒有臉承認我是 – 台灣人 (passwd: shameless)
Posted on October 22nd, 2008 at 1:30 by fr3@K

This post is password protected. To view it please enter your password below:


del.icio.us:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless) digg:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless) spurl:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless) newsvine:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless) furl:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless) Y!:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless) 黑米共享書籤:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless) 推推王:今天, 我沒有臉承認我是 - 台灣人 (passwd: shameless)
搞 FOSS 為哪樁?
Posted on October 13th, 2008 at 0:55 by fr3@K

看了一篇 Slashdot 上有趣的文字 – Getting Paid To Abandon an Open Source Project?. 有感而發, 寫了下面的廢話.
(more…)

del.icio.us:搞 FOSS 為哪樁? digg:搞 FOSS 為哪樁? spurl:搞 FOSS 為哪樁? newsvine:搞 FOSS 為哪樁? furl:搞 FOSS 為哪樁? Y!:搞 FOSS 為哪樁? 黑米共享書籤:搞 FOSS 為哪樁? 推推王:搞 FOSS 為哪樁?
回憶 – 工作與伙伴
Posted on October 5th, 2008 at 17:35 by fr3@K

周六的午夜 (其實是今天凌晨零點多), 跟 Michael 一起回 (前) 公司帶仍然在加班的可憐 Polo 去打撞球. 見到了 Tye, 意外的還看到了幾位北京過來支援 Polo 的同事以及督軍兼在現場打雜的我的老長官 阿國. 熟悉的場景, 親切的臉孔, 還有我的回憶…
(more…)

del.icio.us:回憶 - 工作與伙伴 digg:回憶 - 工作與伙伴 spurl:回憶 - 工作與伙伴 newsvine:回憶 - 工作與伙伴 furl:回憶 - 工作與伙伴 Y!:回憶 - 工作與伙伴 黑米共享書籤:回憶 - 工作與伙伴 推推王:回憶 - 工作與伙伴
Stroustrup & Sutter on C++
Posted on October 3rd, 2008 at 12:02 by fr3@K

超想去聽的啦 – Stroustrup & Sutter on C++ 2008, Second Showing: October 30-31, 2008, in Boston, MA, USA:

Wednesday, October 29, 2008

C++0x Overview (Bjarne Stroustrup)

What Not to Code: Avoiding Bad Design Choices and Worse Implementations (Herb Sutter)

How to Design Good Interfaces (Bjarne Stroustrup)

How to Migrate C++ Code to the Manycore “Free Lunch” (Herb Sutter)

Grill the Experts: Ask Us Anything! (Bjarne Stroustrup & Herb Sutter)

Thursday, October 30, 2008

["Best of Stroustrup & Sutter"] Update of talk voted “Most Informative” at S&S 2007: Concepts and Generic Programming in C++0x (Bjarne Stroustrup)

Safe Locking: Best Practices to Eliminate Race Conditions (Herb Sutter)

C++ in Safety-Critical Systems (Bjarne Stroustrup)

Lock-Free Programming in C++—or How to Juggle Razor Blades (Herb Sutter)

Discussion on Questions Raised During the Seminar (Herb Sutter & Bjarne Stroustrup)

Software Development Best PracticeEmbedded Systems Conference Boston 的套票好像說好似的都一樣要價 US$2795.

尤其是 Software Development Best Practice 的 C++ Track, 看起來非常值得期待. 只是這 US$2795… 可是會讓老婆餓肚子的呢.

del.icio.us:Stroustrup & Sutter on C++ digg:Stroustrup & Sutter on C++ spurl:Stroustrup & Sutter on C++ newsvine:Stroustrup & Sutter on C++ furl:Stroustrup & Sutter on C++ Y!:Stroustrup & Sutter on C++ 黑米共享書籤:Stroustrup & Sutter on C++ 推推王:Stroustrup & Sutter on C++