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

            導航

            隨筆分類

            隨筆檔案

            最新評論

            久久精品午夜一区二区福利| 久久精品国产精品亚洲| 亚洲va久久久噜噜噜久久| 久久免费的精品国产V∧| 久久国产成人精品国产成人亚洲| 欧美精品福利视频一区二区三区久久久精品 | 久久国产乱子伦精品免费午夜| 2021久久国自产拍精品| 色99久久久久高潮综合影院| 久久精品九九亚洲精品| 亚洲精品国产自在久久| 久久综合欧美成人| 麻豆一区二区99久久久久| 色婷婷狠狠久久综合五月| 久久精品国产亚洲综合色| 亚洲乱码精品久久久久.. | 性做久久久久久久久浪潮| 久久这里只有精品首页| 亚洲AV日韩AV永久无码久久| 久久人人爽人人精品视频| avtt天堂网久久精品| 偷偷做久久久久网站| 久久天天躁狠狠躁夜夜2020| 66精品综合久久久久久久| 69国产成人综合久久精品| 色综合久久中文字幕无码| 久久无码专区国产精品发布| 久久久久久国产精品无码下载| 久久精品9988| 久久免费精品一区二区| 69国产成人综合久久精品| 国产精品对白刺激久久久| 91视频国产91久久久| 久久夜色精品国产噜噜麻豆| 中文字幕热久久久久久久| 久久久久久久久久久久久久| 久久亚洲sm情趣捆绑调教| 久久精品国产久精国产果冻传媒| 久久综合久久综合亚洲| 天天爽天天狠久久久综合麻豆 | 国产∨亚洲V天堂无码久久久|