• <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>

            What is "##" string in C code

            See code below(quoting ffmpeg source code)
             1 #define REGISTER_MUXER(X,x) { \
             2     extern AVOutputFormat x##_muxer; \
             3     if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); }
             4 #define REGISTER_DEMUXER(X,x) { \
             5     extern AVInputFormat x##_demuxer; \
             6     if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }
             7 #define REGISTER_MUXDEMUX(X,x)  REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
             8 #define REGISTER_PROTOCOL(X,x) { \
             9     extern URLProtocol x##_protocol; \
            10     if(CONFIG_##X##_PROTOCOL) av_register_protocol2(&x##_protocol, sizeof(x##_protocol)); }

            "##" string in C language code is used for concatenating the two strings which is before and behind it  in a macros definition.
            See a test code below :
            1 #define DEFINE(t, x)  {t x##_##t;}
            3 int main()
            4 {
            5     DEFINE(int, vvv);
            6     return 0;
            7 }

            Use "gcc -E test_sharpsharp.c -o test_sharpsharp.i" command to pre-process this file
            And the output file "test_sharpsharp.i" just looks like below :
            1 int main()
            2 {
            3     {int vvv_int;};
            4     return 0;
            5 }

            The code below is useful, and you can use "##" macro definitions to realize sample templates with C language
            1 #define REGISTER_DATA_COMPARE(x)\
            2     static __inline x x##_compare(x key1, x key2)\
            3     {\
            4         if (key1 > key2) return 1;\
            5         if (key1 < key2) return -1;\
            6         return 0;\
            7     }
            In this way, you can realize a data comparing function set, when you need comparing some type of data, just register it.

            posted on 2012-06-08 10:42 Apollo Fang 閱讀(288) 評論(0)  編輯 收藏 引用 所屬分類: Miscellaneous

            導航

            隨筆分類

            隨筆檔案

            最新評論

            久久精品国产亚洲AV不卡| segui久久国产精品| 日韩欧美亚洲综合久久| 亚洲午夜久久久久久久久电影网| 久久夜色精品国产欧美乱| 国产成人精品久久一区二区三区av| 色播久久人人爽人人爽人人片aV | 久久亚洲色一区二区三区| 亚洲国产高清精品线久久| 欧洲人妻丰满av无码久久不卡| 亚洲一区二区三区日本久久九| 亚洲精品成人久久久| 国产99精品久久| 99精品国产综合久久久久五月天| 久久青草国产手机看片福利盒子| 色狠狠久久综合网| 国产精品99久久久久久猫咪| 欧美丰满熟妇BBB久久久| 色综合久久久久综合99| 久久久久综合网久久| 一本一本久久a久久综合精品蜜桃| 激情五月综合综合久久69| 精品人妻久久久久久888| 国产精品亚洲综合久久| 久久久久一级精品亚洲国产成人综合AV区 | 久久国产精品久久久| 中文字幕人妻色偷偷久久| 天天做夜夜做久久做狠狠| 青青草原1769久久免费播放| 成人国内精品久久久久一区| 一本一本久久A久久综合精品| 性做久久久久久久久浪潮| 久久久久一级精品亚洲国产成人综合AV区 | 久久强奷乱码老熟女| 99久久精品无码一区二区毛片| 99久久夜色精品国产网站| 久久精品国产一区二区三区日韩| 精品久久久久久久久午夜福利| 亚洲国产成人久久综合碰| 狠狠色丁香久久婷婷综| 国产高潮国产高潮久久久|