November 19, 2005

程式碼的 Orz 之道

昨天在改一份 Intel Confidential 的程式碼,是關於多媒體應用效能調校的最佳化處理,首先,在檔案開頭很明顯的指出: (以下是從公開的 Intel Corporation Proprietary Information 複製過來的,或許跟原始程式碼列出的項目有出入)
    /*//////////////////////////////////////////////////////////////////////
    //
    //                  INTEL CORPORATION PROPRIETARY INFORMATION
    //     This software is supplied under the terms of a license agreement or
    //     nondisclosure agreement with Intel Corporation and may not be copied
    //     or disclosed except in accordance with the terms of that agreement.
    //          Copyright(c) 2003-2005 Intel Corporation. All Rights Reserved.
    //
    */
    
所以,我不可能也被不允許將該檔案全部複製列出,不過有趣的是在該檔案的開頭有以下程式碼片斷:(憑印象寫出的)
    #ifdef __ICL
    #pragma message("Warning: Don't use Intel(R) compiler to build this file")
    #endif
well,我們都知道 Intel C++ compiler 是在 Intel Xscale 平台上,擁有效能最佳化的 compiler suite,而我要修改的那份程式碼,自然也需要 Intel C++ compiler,才能彰顯其效能上的優越,但問題是,因為某種緣故 (Intel C++ compiler is buggy?),該檔案必須用 Microsoft C/C++ compiler 或 GCC 來編譯,最後再整到專案中...

聽起來很離譜,不過這種 workaround 還算常見,這讓我想到 b6s 前輩與 pcman 曾在 IRC channel 提到:
    11月 18 00:11:08 pcman  b6s: 當我發現 M$ 自己家也是用 dirty hack
    在處理 windows 的 bug 的時候,突然覺得我們並不孤單
    11月 18 00:11:17 b6s    pcman: 是啊
    11月 18 00:11:36 pcman  b6s: windows 9x/nt 還得用不同的hack方式
    11月 18 00:11:37 pcman  b6s: 我猜 M$ 自己的 developer 一定也在臭罵
    11月 18 00:11:55 b6s    有啊,的確有人在罵
    11月 18 00:12:16 pcman  b6s: 你說的那個狀況我是沒有遇到過
    11月 18 00:12:26 b6s    win2k 流出來的 source 裡罵的是不可以用 tab
    要用 4 個空白,不然他們的 version control server 會爛掉
    11月 18 00:12:54 b6s    write a solid code 作者罵的是他們被 compiler team 婊到
    
由此可見,當 workaround 累積到一定程度,就變成 Orz 的集合了,此乃「程式碼的 Orz 之道」。 由 jserv 發表於 November 19, 2005 03:37 PM
迴響
發表迴響









記住我的資訊?