summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/alternate-keywords.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/gcc~13/alternate-keywords.html')
-rw-r--r--devdocs/gcc~13/alternate-keywords.html9
1 files changed, 9 insertions, 0 deletions
diff --git a/devdocs/gcc~13/alternate-keywords.html b/devdocs/gcc~13/alternate-keywords.html
new file mode 100644
index 00000000..4d35503d
--- /dev/null
+++ b/devdocs/gcc~13/alternate-keywords.html
@@ -0,0 +1,9 @@
+<div class="section-level-extent" id="Alternate-Keywords"> <div class="nav-panel"> <p> Next: <a href="incomplete-enums" accesskey="n" rel="next">Incomplete <code class="code">enum</code> Types</a>, Previous: <a href="using-assembly-language-with-c" accesskey="p" rel="prev">How to Use Inline Assembly Language in C Code</a>, Up: <a href="c-extensions" accesskey="u" rel="up">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="Alternate-Keywords-1"><span>6.48 Alternate Keywords<a class="copiable-link" href="#Alternate-Keywords-1"> ¶</a></span></h1> <p><samp class="option">-ansi</samp> and the various <samp class="option">-std</samp> options disable certain keywords. This causes trouble when you want to use GNU C extensions, or a general-purpose header file that should be usable by all programs, including ISO C programs. The keywords <code class="code">asm</code>, <code class="code">typeof</code> and <code class="code">inline</code> are not available in programs compiled with <samp class="option">-ansi</samp> or <samp class="option">-std</samp> (although <code class="code">inline</code> can be used in a program compiled with <samp class="option">-std=c99</samp> or a later standard). The ISO C99 keyword <code class="code">restrict</code> is only available when <samp class="option">-std=gnu99</samp> (which will eventually be the default) or <samp class="option">-std=c99</samp> (or the equivalent <samp class="option">-std=iso9899:1999</samp>), or an option for a later standard version, is used. </p> <p>The way to solve these problems is to put ‘<samp class="samp">__</samp>’ at the beginning and end of each problematical keyword. For example, use <code class="code">__asm__</code> instead of <code class="code">asm</code>, and <code class="code">__inline__</code> instead of <code class="code">inline</code>. </p> <p>Other C compilers won’t accept these alternative keywords; if you want to compile with another compiler, you can define the alternate keywords as macros to replace them with the customary keywords. It looks like this: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#ifndef __GNUC__
+#define __asm__ asm
+#endif</pre>
+</div> <p><samp class="option">-pedantic</samp> and other options cause warnings for many GNU C extensions. You can prevent such warnings within one expression by writing <code class="code">__extension__</code> before the expression. <code class="code">__extension__</code> has no effect aside from this. </p> </div> <div class="nav-panel"> <p> Next: <a href="incomplete-enums">Incomplete <code class="code">enum</code> Types</a>, Previous: <a href="using-assembly-language-with-c">How to Use Inline Assembly Language in C Code</a>, Up: <a href="c-extensions">Extensions to the C Language Family</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
+ <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alternate-Keywords.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Alternate-Keywords.html</a>
+ </p>
+</div>