A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../algorithm/../../cpp/../c/preprocessor/warning.html below:

Diagnostic directives - cppreference.com

Shows the given error message and renders the program ill-formed, or given warning message without affect the validity of the program(since C23).

[edit] Syntax #error diagnostic-message (1) #warning diagnostic-message (2) (since C23) [edit] Explanation

1) After encountering the #error directive, an implementation displays the message diagnostic-message and renders the program ill-formed (the compilation stops).

2) Same as (1), except that the validity of the program is not affected and the compilation continues.

diagnostic-message can consist of several words not necessarily in quotes.

[edit] Notes

Before its standardization in C23, #warning has been provided by many compilers in all modes as a conforming extension.

[edit] Example
#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 !!
[edit] References
[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4