C + + Library research notes-managing outdated Code with __ATTRIBUTE__ ((deprecated))

Source: Internet
Author: User
Tags deprecated

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))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.