zoukankan      html  css  js  c++  java
  • C++库研究笔记--用__attribute__((deprecated)) 管理过时代码

    用__attribute__((deprecated)) 管理过时代码。同一时候保留兼容的接口

    Linux下:

    #define  DEPR_AFTER __attribute__((deprecated))
    #define  DEPR_BEFOR 
    
    
    class DEPR_BEFOR AAA
    {
    }DEPR_AFTER;
    
    int main(int argc, char** argv)
    {
        typedef float T;
        AAA aa;
    
        return 0;
    }

    g++ main.cpp -o main

    main.cpp: In function ‘int main(int, char**)’:
    main.cpp:16:9: warning: ‘AAA’ is deprecated (declared at main.cpp:9) [-Wdeprecated-declarations]


    WINDOWS下:

    对于VC,类似如OPENCV定义:

    #if defined __GNUC__
        #define __CV_GPU_DEPR_BEFORE__
        #define __CV_GPU_DEPR_AFTER__ __attribute__ ((deprecated))
    #elif defined(__MSVC__) //|| defined(__CUDACC__)
        #pragma deprecated(DevMem2D_)
        #define __CV_GPU_DEPR_BEFORE__ __declspec(deprecated)
        #define __CV_GPU_DEPR_AFTER__
    #else
        #define __CV_GPU_DEPR_BEFORE__
        #define __CV_GPU_DEPR_AFTER__
    #endif


  • 相关阅读:
    ZOJ1542 POJ1861
    Codeforces Round #194 (Div. 2) 部分题解
    SRM585 div2
    hdu 4627 The Unsolvable Problem
    hdu 4622 Reincarnation
    hdu 4617 Weapon
    hdu 4609 3-idiots
    hdu 4616 Game
    hdu 4611 Balls Rearrangement
    hdu 4618 Palindrome Sub-Array
  • 原文地址:https://www.cnblogs.com/brucemengbm/p/7388087.html
Copyright © 2011-2022 走看看