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

◆ DRAKE_DEPRECATED

#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:

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

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.