description | title | ms.date | f1_keywords | helpviewer_keywords | ||||
---|---|---|---|---|---|---|---|---|
Learn more about: #warning directive (C/C++) |
#warning directive (C/C++) |
11/08/2023 |
|
|
The #warning directive emits a user-specified warning message at compile time, and does not stop the compilation. This directive is a standard feature since C23 and C++23.
#warning token-string
The warning message that this directive emits includes the token-string parameter. The token-string parameter is not subject to macro expansion and can be optionally enclosed in quotes. This directive is used to inform the developer of a non-fatal issue that may have occured, or to disseminate important information. The following example shows how the #warning directive is used:
#if defined(_LEGACY_FEATURE_FLAG)
#warning "_LEGACY_FEATURE is deprecated and should not be used."
#endif