Managing outdated code with __ATTRIBUTE__ ((deprecated)), preserving compatible interfaces at the same time
Under 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]
Under Windows:
for VCs. Similar as OPENCV definition:
#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
C + + Library research notes-managing outdated Code with __ATTRIBUTE__ ((deprecated))