• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            想你

            常用鏈接

            統計

            最新評論

            為什么不向visual assist取取經呢?
            re: loki技法(1).靜態斷言 主打歌 2010-09-06 23:10
            讓boost, c++設計新思維統統去見鬼吧。看哥的靜態斷言的巧妙實現吧。

            可以在下列范圍內使用(已經在vc,gcc中測試):
            在名字空間域中使用 ;
            在函數域中使用 ;
            在類域中使用 ;
            在類模板中使用 。
            在函數模板中使用 。

            比boost強大的是關鍵是還能支持c語言,不使用模版使得編譯時間大大縮短!!還能夠打印自定義的錯誤信息(我想這比啥都強)。
            注意:gcc 的c編譯器居然允許0除以0的結果作為數組長度。此時只有警告,但是程序啟動就會立即產生浮點數異常,退出。g++工作正常。vc的c編譯器工作正常。
            #define JOIN(x,y) x ## y
            #define JOIN_1(x,y) JOIN(x, y)
            #define JOIN_2(x,y) JOIN_1(x, y)

            /*It's the begin of all error message.*/
            #define ERRORMSG_BEGIN ATTENTION__The_assertion_error_is__

            /*
            *To fetch a error if testnum==0||testnum==false, by divide 0.
            *Cast to int to avoid warning caused by bool division.
            */
            #define IF_ERROR(testnum) (((int)(testnum))/((int)(testnum)))


            /*
            *The errormsg only support following characters: [a-zA-Z0-9] and '_'.
            *Because it's a part of variable's name.
            *Example:STATIC_ASSERT(sizeof(int) <= sizeof(short), The_sizeof_int_is_larger_than_short__)
            *For above example, (Most) compilers can print error include following message:
            ATTENTION__The_assertion_error_is__The_sizeof_int_is_larger_than_short__234
            *The number in the end is the linenumber of the position of the macro been called.
            */
            #ifndef NDEBUG
            #ifndef _MSC_VER
            #define STATIC_ASSERT(testnum, errormsg) static char JOIN_2(JOIN_1(ERRORMSG_BEGIN,errormsg),__LINE__)[IF_ERROR(testnum)];
            #else
            #define STATIC_ASSERT(testnum, errormsg) static char JOIN_1(ERRORMSG_BEGIN,errormsg)[IF_ERROR(testnum)];
            #endif
            #else
            #define STATIC_ASSERT(testnum, errormsg)
            #endif

            //有看不懂英文的請留言咨詢。
            正好2000年是閏年,不然你慘了。不過正好100年內不錯,不管了。
            還有那個夏時令的標志最好清空設置
            ret_time->tm_isdst = 0;
            多謝先生了。
            成人免费网站久久久| 亚洲精品美女久久久久99| 精品久久久久久国产| 国产999精品久久久久久| 伊人 久久 精品| 国产精品久久久久9999| 久久久久久噜噜精品免费直播| 亚洲国产成人精品91久久久 | 亚洲日本va中文字幕久久| 久久精品九九亚洲精品| 久久人妻少妇嫩草AV蜜桃| 精品久久久久久无码专区| 一本色道久久88综合日韩精品 | 99久久国产综合精品网成人影院| 久久噜噜久久久精品66| 久久综合狠狠综合久久| 久久久久99精品成人片| 国产精品无码久久久久久| 人妻中文久久久久| 久久综合九色综合欧美狠狠| 97久久婷婷五月综合色d啪蜜芽| 99久久精品免费看国产| 久久精品亚洲一区二区三区浴池| 久久99这里只有精品国产| 办公室久久精品| 国产午夜精品久久久久九九电影| 精品久久8x国产免费观看| 婷婷伊人久久大香线蕉AV | 国产亚洲美女精品久久久| 久久99中文字幕久久| 亚洲午夜久久久久久久久久| 婷婷久久五月天| 久久99热这里只频精品6| 青青青青久久精品国产h久久精品五福影院1421| 国内高清久久久久久| 一本久久免费视频| 久久久久久国产a免费观看黄色大片 | 99久久精品这里只有精品| 精品久久久久久亚洲精品| 久久精品麻豆日日躁夜夜躁| 久久国产欧美日韩精品|