BDE 4.14.0 Production release
|
Macros | |
#define | BSLA_WARNING(x) |
Provide a macro to emit a warning when a function is called.
BSLA_WARNING
is activeThis component provides a macro that indicates that a compiler warning should be emitted when a given function is called.
BSLA_WARNING(QUOTED_MESSAGE)
: This annotation, when used, will cause a compile-time warning containing the specified QUOTED_MESSAGE
, which must be a string contained in double quotes, when a call to the so-annotated function is not removed through dead-code elimination or other optimizations. While it is possible to leave the function undefined, thus incurring a link-time failure, with the use of this macro the invalid call will be diagnosed earlier (i.e., at compile time), and the diagnostic will include the location of the function call.
BSLA_WARNING_IS_ACTIVE
: The macro BSLA_WARNING_IS_ACTIVE
is defined if BSLA_WARNING
expands to something with the desired effect; otherwise BSLA_WARNING_IS_ACTIVE
is not defined and BSLA_WARNING
expands to nothing.
This section illustrates intended use of this component.
First, we declare and define a function annotated with BSLA_WARNING
. Note that the argument to BSLA_WARNING
must be a quoted string:
Now, in main
, we call usageFunc
:
Finally, observe the following warning issued by the compiler:
#define BSLA_WARNING | ( | x | ) |