Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deprecate Typedef

I have a few TypeDefs that I want to deprecate. I am doing this to retain backward compatibility with code that already exists. Is there an elegant (or maybe not so elegant) solution to this? I would like it to be platform independent but if there is a Visual Studio only solution, that will do as well.

like image 522
Samaursa Avatar asked Feb 14 '11 18:02

Samaursa


1 Answers

In MSVC++, you can deprecate typedef like this:

typedef __declspec(deprecated) int myint;

The MSVC++ compiler will generate warning that myintis deprecated!

And if you want the compiler to generate a specific message when compiling a deprecated typedef, then do this:

typedef __declspec(deprecated("myint is deprecated, so most likely in the next version this myint will be missing")) int myint;
like image 120
Nawaz Avatar answered Sep 17 '22 17:09

Nawaz