From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/preprocessor%2Ferror.html | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 devdocs/c/preprocessor%2Ferror.html (limited to 'devdocs/c/preprocessor%2Ferror.html') diff --git a/devdocs/c/preprocessor%2Ferror.html b/devdocs/c/preprocessor%2Ferror.html new file mode 100644 index 00000000..decd26b2 --- /dev/null +++ b/devdocs/c/preprocessor%2Ferror.html @@ -0,0 +1,37 @@ +

Diagnostic directives

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

+

Syntax

+ + +
#error diagnostic-message (1)
#warning diagnostic-message (2) (since C23)

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.

+

Notes

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

+

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 !!

References

See also

+
C++ documentation for Diagnostic directives
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/preprocessor/error +

+
-- cgit v1.2.3