Is there a way of marking methods/classes in C++ as obsolete?
In c# you can write:
[Obsolete("You shouldn't use this method anymore.")]
void foo() {}
I use the GNU toolchain/Eclipse CDT if that matters.
The easiest way is with a #define DEPRECATED
. On GCC, it expands to __attribute__((deprecated))
, on Visual C++ it expands to __declspec(deprecated)
, and on compilers that do not have something silimar it expands to nothing.
Only using compiler dependent pragmas: look up the documentation
int old_fn () __attribute__ ((deprecated));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With