BDE 4.14.0 Production release
|
Macros | |
#define | BSLA_DEPRECATED |
#define | BSLA_DEPRECATED_MESSAGE(message) |
Provide compiler-hint macros to indicate deprecated entities.
This component provides preprocessor macros that hint to the compiler that a function, variable, type, typedef
, struct
member, enum
type, or template specialization is deprecated. This is useful, for example, when identifying functions that are expected to be removed in a future version of a library.
BSLA_DEPRECATED
: This annotation will, when used, cause a compile-time warning if the so-annotated function, variable, type, typedef
, struct
member, enum
type, or template specialization is used anywhere within the source file. The warning includes the location of the declaration of the deprecated entity to enable users to find further information about the deprecation, or what they should use instead.
BSLA_DEPRECATED_MESSAGE(QUOTED_MESSAGE)
: This annotation will, when used, cause a compile-time warning if the so-annotated function, variable, type, typedef
, struct
member, enum
type, or template specialization is used anywhere within the source file. The compiler warning will contain the contents of the specified QUOTED_MESSAGE
, which must be a double-quoted string. The warning includes the location of the declaration of the deprecated entity to enable users to find further information about the deprecation, and what they should use instead. Note that on some compilers QUOTED_MESSAGE
is ignored.
BSLA_DEPRECATED_IS_ACTIVE
: The macro BSLA_DEPRECATED_IS_ACTIVE
is defined if BSLA_DEPRECATED
and BSLA_DEPRECATED_MESSAGE
are both active and have the desired effect; otherwise, BSLA_DEPRECATED_IS_ACTIVE
is not defined and both other macros expand to nothing.
This section illustrates intended use of this component.
First, we define a deprecated type UsageType
:
Then, we define a function usageFunc
that is deprecated:
Next, we define a variable usageVar
that is deprecated:
Then, we define a typedef UsageTypedef
that is deprecated:
Next, we define a struct
with a member d_y
that is deprecated:
Then, we define an enum
UsageEnum
that is deprecated:
Next, we define a template this is only deprecated in the case where it is specialized with the int
type as a template parameter:
Then, as long as we don't use them, no warnings will be issued.
Next, we use UsageType
:
which results in the following warnings:
Then, we call usageFunc
:
which results in the following warnings:
Next, we access usageVar
:
which results in the following warnings:
Then, we use UsageTypedef
:
which results in the following warnings:
Next, we access the deprecated member of UsageStruct
:
which results in the following warnings:
Now, we use the deprecated UsageEnum
:
which results in the following warnings:
Finally, we access the deprecated specialization of usageAbs
:
which results in the following warnings:
#define BSLA_DEPRECATED |
#define BSLA_DEPRECATED_MESSAGE | ( | message | ) |