Drake
drake_deprecated.h File Reference

Provides a portable macro for use in generating compile-time warnings for use of code that is permitted but discouraged. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DRAKE_DEPRECATED(message)
 Use DRAKE_DEPRECATED("message") to discourage use of particular classes, typedefs, variables, non-static data members, functions, arguments, enumerations, and template specializations. More...
 

Detailed Description

Provides a portable macro for use in generating compile-time warnings for use of code that is permitted but discouraged.

Macro Definition Documentation

#define DRAKE_DEPRECATED (   message)

Use DRAKE_DEPRECATED("message") to discourage use of particular classes, typedefs, variables, non-static data members, functions, arguments, enumerations, and template specializations.

A compile time warning will be issued displaying the given message, preceded by "DRAKE DEPRECATED: ".

This is typically used for constructs that have been replaced by something better and it is good practice to suggest the appropriate replacement in the deprecation message. Deprecation warnings are conventionally used to convey to users that a feature they are depending on will be removed in a future release.

Usage:

1 // Attribute comes *before* declaration of a deprecated function or variable;
2 // no semicolon is allowed.
3 DRAKE_DEPRECATED("f() is slow; use g() instead.")
4 int f(int arg);
5 
6 // Attribute comes *after* struct, class, enum keyword.
7 class DRAKE_DEPRECATED("Use MyNewClass instead.")
8 MyClass {
9 };

This feature is standard in C++14 compilers via the [[deprecated]] attribute, and this macro will generate the standard attribute when compiled with a C++14-compliant compiler.