C preprocessor: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile app edit iOS app edit App section source
Line 282:
 
=== Warning ===
As of [[C23 (C standard revision)|C23]]<ref name="N3096">{{cite web |title=WG14-N3096 : Draft for ISO/IEC 9899:2023 |url=https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf |website=open-std.org |archive-url=https://web.archive.org/web/20230402172459/https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf |archive-date=2 April 2023 |date=1 April 2023 |url-status=live}}</ref> and [[C++23]],<ref>{{Cite web|title=Working Draft, Standard for Programming Language C++|url=https://open-std.org/JTC1/SC22/WG21/docs/papers/2023/n4944.pdf|date=2023-03-22}}</ref> a warning directive, <code>#warning</code>, to print a message without aborting is provided. Some typical uses are to warn about the use of [[deprecated]] functionality. For example:
 
Prior to C23 and C++23, this directive existed in many compilers as a non-standard feature, such as the C compilers by GNU, Intel, Microsoft and IBM. Because it was non-standard, the warning macro had varying forms:
<syntaxhighlight lang="c">
// GNU, Intel and IBM
#warning "Do not use ABC, which is deprecated. Use XYZ instead."
</syntaxhighlight>
 
<syntaxhighlight lang="c">
// Microsoft
#pragma message("Do not use ABC, which is deprecated. Use XYZ instead.")
</syntaxhighlight>
 
Prior to C23 and C++23, this directive existed in many compilers as a non-standard feature, such as the C compilers by GNU, Intel, Microsoft and IBM.
 
=== Binary resource inclusion ===