#pragma invalidates signature based function?

in Visual Studio, can you # redefine a function based on a function signature, not just a name?

In my case, we are in C ++ and do not want to discount all the tastes of the function

int foo();        <-- we want to keep
int foo(int x);   <-- we want to deprecate
+5
source share
2 answers

Just do the following:

__declspec(deprecated) void foo(int) {}

And if you want the compiler to generate a specific message when compiling an obsolete function, do the following:

__declspec(deprecated("foo(int) is a deprecated function.")) void foo(int) {}
+12
source

an obsolete one can also be specified in__declspec() (which is even better than #pragma, since it allows you if desired.

+3
source

All Articles