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

            導(dǎo)航

            隨筆分類

            隨筆檔案

            最新評(píng)論

            色综合久久久久无码专区| 亚洲国产精品无码久久久秋霞2| 97精品依人久久久大香线蕉97| 久久亚洲熟女cc98cm| 狼狼综合久久久久综合网| 9999国产精品欧美久久久久久| 久久久久国产成人精品亚洲午夜| 99久久做夜夜爱天天做精品| 亚洲AV无码久久精品蜜桃| 日本一区精品久久久久影院| 久久久久久伊人高潮影院| 久久97久久97精品免视看秋霞| 久久这里只有精品18| 国产精品va久久久久久久| 精品久久久久久综合日本| 怡红院日本一道日本久久| 久久午夜无码鲁丝片秋霞| 欧美精品久久久久久久自慰| 2020最新久久久视精品爱| 色妞色综合久久夜夜| 欧美日韩精品久久久免费观看| 亚洲国产成人久久精品影视| 久久妇女高潮几次MBA| 久久丝袜精品中文字幕| 久久精品女人天堂AV麻| 久久精品夜夜夜夜夜久久| 精品无码久久久久国产| 久久国产亚洲高清观看| 99久久做夜夜爱天天做精品| 久久精品无码免费不卡| 久久精品国产清自在天天线| 久久亚洲国产午夜精品理论片| 国产精品毛片久久久久久久| 久久国产成人精品麻豆| 国内精品伊人久久久久av一坑 | 亚洲美日韩Av中文字幕无码久久久妻妇 | 久久中文字幕一区二区| 国产99精品久久| 久久亚洲欧美日本精品| 精品久久777| 久久91精品综合国产首页|