• <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;
            多謝先生了。
            色婷婷综合久久久久中文 | 久久Av无码精品人妻系列| 99精品国产99久久久久久97| 国产V亚洲V天堂无码久久久| yellow中文字幕久久网| 伊人色综合九久久天天蜜桃| 久久午夜无码鲁丝片| 久久久久免费视频| 久久精品国产色蜜蜜麻豆| 国产99久久九九精品无码| 午夜欧美精品久久久久久久| 久久高清一级毛片| 天天爽天天狠久久久综合麻豆| 久久免费视频6| 亚洲伊人久久大香线蕉苏妲己| 香蕉久久av一区二区三区| 久久91精品国产91久| 久久久国产一区二区三区| 国产精品久久久久久| 久久天天躁狠狠躁夜夜96流白浆| 久久久精品日本一区二区三区| 久久国产精品一区二区| 久久精品亚洲精品国产色婷| 97精品伊人久久大香线蕉| 日产久久强奸免费的看| 精品久久人人妻人人做精品| 亚洲国产精品久久66| 久久国产精品成人免费| 丁香五月网久久综合| 韩国无遮挡三级久久| 91秦先生久久久久久久| 国产福利电影一区二区三区久久老子无码午夜伦不 | 亚洲级αV无码毛片久久精品| 久久国产欧美日韩精品免费| 久久久久一本毛久久久| 久久天天日天天操综合伊人av| 久久99精品九九九久久婷婷| 久久电影网| 成人久久免费网站| 久久综合精品国产二区无码| 91精品国产综合久久久久久|