Shows the given error message and renders the program ill-formed, or given warning message without affect the validity of the program(since C23).
Contents |
#errordiagnostic-message | (1) | ||||||||
#warningdiagnostic-message | (2) | (since C23) | |||||||
#error directive, an implementation displays the messagediagnostic-message and renders the program ill-formed (the compilation stops).diagnostic-message can consist of several words not necessarily in quotes.
Before its standardization in C23,#warning has been provided by many compilers in all modes as a conforming extension.
#if __STDC__ != 1# error "Not a standard compliant compiler"#endif #if __STDC_VERSION__ >= 202311L# warning "Using #warning as a standard feature"#endif #include <stdio.h> int main(void){printf("The compiler used conforms to the ISO C Standard !!");}
Possible output:
The compiler used conforms to the ISO C Standard !!
C++ documentation forDiagnostic directives |