Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#pragma deprecate a function based on signature?

in Visual Studio is it possible to #deprecated a function, based on the signature of the function and not simply the name?

In my case we're in C++ and don't want to deprecate all flavors of the function

int foo();        <-- we want to keep
int foo(int x);   <-- we want to deprecate
like image 498
stuck Avatar asked Jan 27 '11 17:01

stuck


1 Answers

Just do this:

__declspec(deprecated) void foo(int) {}

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

__declspec(deprecated("foo(int) is a deprecated function.")) void foo(int) {}
like image 125
Nawaz Avatar answered Sep 29 '22 15:09

Nawaz