• <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 閱讀(296) 評論(0)  編輯 收藏 引用 所屬分類: Miscellaneous

            導航

            隨筆分類

            隨筆檔案

            最新評論

            婷婷久久综合九色综合绿巨人| 综合久久给合久久狠狠狠97色| 久久亚洲国产成人精品无码区| 日本高清无卡码一区二区久久| 久久综合鬼色88久久精品综合自在自线噜噜| 午夜精品久久久内射近拍高清| 久久久久久久久久久| 久久不射电影网| 亚洲国产精品嫩草影院久久| 欧美精品久久久久久久自慰| 一本一道久久a久久精品综合| 久久久女人与动物群交毛片| 亚洲国产欧美国产综合久久| 国产精品久久久久久久久久影院| 久久久精品波多野结衣| 中文字幕亚洲综合久久2| 色欲久久久天天天综合网| 国产精品久久久久久久午夜片| jizzjizz国产精品久久| 久久久久成人精品无码中文字幕 | 合区精品久久久中文字幕一区| 亚洲国产精品一区二区久久hs| 久久国产精品国语对白| 日韩久久久久中文字幕人妻 | 国内精品久久久久久99蜜桃| 久久婷婷色综合一区二区| 色综合合久久天天给综看| 久久精品亚洲男人的天堂| 久久久青草久久久青草| 亚洲精品高清久久| 久久99精品综合国产首页| AV狠狠色丁香婷婷综合久久| 日本久久久久亚洲中字幕| 久久精品麻豆日日躁夜夜躁| 久久精品国产亚洲精品2020| 色诱久久久久综合网ywww| 无码人妻久久久一区二区三区| 色婷婷综合久久久久中文一区二区| 久久久久无码精品国产| 99久久er这里只有精品18| 久久精品99久久香蕉国产色戒|