c preprocessor - How to generate a warning when a deprecated variable / structure is used -


sorry seems noddy question how compiler generate warning when variable / structure used?

for example if have following code:

   int getabstractedfoo()    {         return 1;    }    struct new_name    {         int foo;    }    typedef new_name old_name; 

how do #warning "warning "old_name" depreciated please use new_name"

and expanding on further how "warning accessing foo directly has been depreciated please use "abstractedfoo"?

i have had trouble googling beyond basic #warning when header used.

-thanks, chris

ah bit more digging , came across post , fab answer michael platings:

c++ mark deprecated

i think purposes shall extend macro to:

#define deprecate( var , explanation )   var __attribute__((availability(myframework,introduced=1,deprecated=2.1,obsoleted=3.0, message= explanation)));  deprecate ( typedef old_name new_name, “please use new_name”); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -