242 lines
19 KiB
HTML
242 lines
19 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- Copyright (C) 1988-2016 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with the
|
|
Invariant Sections being "Funding Free Software", the Front-Cover
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
|
(see below). A copy of the license is included in the section entitled
|
|
"GNU Free Documentation License".
|
|
|
|
(a) The FSF's Front-Cover Text is:
|
|
|
|
A GNU Manual
|
|
|
|
(b) The FSF's Back-Cover Text is:
|
|
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
|
software. Copies published by the Free Software Foundation raise
|
|
funds for GNU development. -->
|
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<title>Using the GNU Compiler Collection (GCC): C Extensions</title>
|
|
|
|
<meta name="description" content="Using the GNU Compiler Collection (GCC): C Extensions">
|
|
<meta name="keywords" content="Using the GNU Compiler Collection (GCC): C Extensions">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<link href="index.html#Top" rel="start" title="Top">
|
|
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="index.html#Top" rel="up" title="Top">
|
|
<link href="Statement-Exprs.html#Statement-Exprs" rel="next" title="Statement Exprs">
|
|
<link href="Exception-handling.html#Exception-handling" rel="prev" title="Exception handling">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.smallquotation {font-size: smaller}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.indentedblock {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
div.smalldisplay {margin-left: 3.2em}
|
|
div.smallexample {margin-left: 3.2em}
|
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
|
div.smalllisp {margin-left: 3.2em}
|
|
kbd {font-style:oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
|
pre.smallexample {font-size: smaller}
|
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
|
pre.smalllisp {font-size: smaller}
|
|
span.nocodebreak {white-space:nowrap}
|
|
span.nolinebreak {white-space:nowrap}
|
|
span.roman {font-family:serif; font-weight:normal}
|
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
|
<a name="C-Extensions"></a>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" accesskey="n" rel="next">C++ Extensions</a>, Previous: <a href="C_002b_002b-Implementation.html#C_002b_002b-Implementation" accesskey="p" rel="prev">C++ Implementation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<a name="Extensions-to-the-C-Language-Family"></a>
|
|
<h2 class="chapter">6 Extensions to the C Language Family</h2>
|
|
<a name="index-extensions_002c-C-language"></a>
|
|
<a name="index-C-language-extensions"></a>
|
|
|
|
<a name="index-pedantic-3"></a>
|
|
<p>GNU C provides several language features not found in ISO standard C.
|
|
(The <samp>-pedantic</samp> option directs GCC to print a warning message if
|
|
any of these features is used.) To test for the availability of these
|
|
features in conditional compilation, check for a predefined macro
|
|
<code>__GNUC__</code>, which is always defined under GCC.
|
|
</p>
|
|
<p>These extensions are available in C and Objective-C. Most of them are
|
|
also available in C++. See <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions">Extensions to the
|
|
C++ Language</a>, for extensions that apply <em>only</em> to C++.
|
|
</p>
|
|
<p>Some features that are in ISO C99 but not C90 or C++ are also, as
|
|
extensions, accepted by GCC in C90 mode and in C++.
|
|
</p>
|
|
<table class="menu" border="0" cellspacing="0">
|
|
<tr><td align="left" valign="top">• <a href="Statement-Exprs.html#Statement-Exprs" accesskey="1">Statement Exprs</a>:</td><td> </td><td align="left" valign="top">Putting statements and declarations inside expressions.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Local-Labels.html#Local-Labels" accesskey="2">Local Labels</a>:</td><td> </td><td align="left" valign="top">Labels local to a block.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Labels-as-Values.html#Labels-as-Values" accesskey="3">Labels as Values</a>:</td><td> </td><td align="left" valign="top">Getting pointers to labels, and computed gotos.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Nested-Functions.html#Nested-Functions" accesskey="4">Nested Functions</a>:</td><td> </td><td align="left" valign="top">As in Algol and Pascal, lexical scoping of functions.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Constructing-Calls.html#Constructing-Calls" accesskey="5">Constructing Calls</a>:</td><td> </td><td align="left" valign="top">Dispatching a call to another function.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Typeof.html#Typeof" accesskey="6">Typeof</a>:</td><td> </td><td align="left" valign="top"><code>typeof</code>: referring to the type of an expression.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Conditionals.html#Conditionals" accesskey="7">Conditionals</a>:</td><td> </td><td align="left" valign="top">Omitting the middle operand of a ‘<samp>?:</samp>’ expression.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="_005f_005fint128.html#g_t_005f_005fint128" accesskey="8">__int128</a>:</td><td> </td><td align="left" valign="top">128-bit integers—<code>__int128</code>.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Long-Long.html#Long-Long" accesskey="9">Long Long</a>:</td><td> </td><td align="left" valign="top">Double-word integers—<code>long long int</code>.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Complex.html#Complex">Complex</a>:</td><td> </td><td align="left" valign="top">Data types for complex numbers.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Floating-Types.html#Floating-Types">Floating Types</a>:</td><td> </td><td align="left" valign="top">Additional Floating Types.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Half_002dPrecision.html#Half_002dPrecision">Half-Precision</a>:</td><td> </td><td align="left" valign="top">Half-Precision Floating Point.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Decimal-Float.html#Decimal-Float">Decimal Float</a>:</td><td> </td><td align="left" valign="top">Decimal Floating Types.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Hex-Floats.html#Hex-Floats">Hex Floats</a>:</td><td> </td><td align="left" valign="top">Hexadecimal floating-point constants.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Fixed_002dPoint.html#Fixed_002dPoint">Fixed-Point</a>:</td><td> </td><td align="left" valign="top">Fixed-Point Types.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Named-Address-Spaces.html#Named-Address-Spaces">Named Address Spaces</a>:</td><td> </td><td align="left" valign="top">Named address spaces.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Zero-Length.html#Zero-Length">Zero Length</a>:</td><td> </td><td align="left" valign="top">Zero-length arrays.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Empty-Structures.html#Empty-Structures">Empty Structures</a>:</td><td> </td><td align="left" valign="top">Structures with no members.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Variable-Length.html#Variable-Length">Variable Length</a>:</td><td> </td><td align="left" valign="top">Arrays whose length is computed at run time.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Variadic-Macros.html#Variadic-Macros">Variadic Macros</a>:</td><td> </td><td align="left" valign="top">Macros with a variable number of arguments.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Escaped-Newlines.html#Escaped-Newlines">Escaped Newlines</a>:</td><td> </td><td align="left" valign="top">Slightly looser rules for escaped newlines.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Subscripting.html#Subscripting">Subscripting</a>:</td><td> </td><td align="left" valign="top">Any array can be subscripted, even if not an lvalue.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Pointer-Arith.html#Pointer-Arith">Pointer Arith</a>:</td><td> </td><td align="left" valign="top">Arithmetic on <code>void</code>-pointers and function pointers.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Pointers-to-Arrays.html#Pointers-to-Arrays">Pointers to Arrays</a>:</td><td> </td><td align="left" valign="top">Pointers to arrays with qualifiers work as expected.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Initializers.html#Initializers">Initializers</a>:</td><td> </td><td align="left" valign="top">Non-constant initializers.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Compound-Literals.html#Compound-Literals">Compound Literals</a>:</td><td> </td><td align="left" valign="top">Compound literals give structures, unions
|
|
or arrays as values.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Designated-Inits.html#Designated-Inits">Designated Inits</a>:</td><td> </td><td align="left" valign="top">Labeling elements of initializers.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Case-Ranges.html#Case-Ranges">Case Ranges</a>:</td><td> </td><td align="left" valign="top">‘case 1 ... 9’ and such.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Cast-to-Union.html#Cast-to-Union">Cast to Union</a>:</td><td> </td><td align="left" valign="top">Casting to union type from any member of the union.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Mixed-Declarations.html#Mixed-Declarations">Mixed Declarations</a>:</td><td> </td><td align="left" valign="top">Mixing declarations and code.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>:</td><td> </td><td align="left" valign="top">Declaring that functions have no side effects,
|
|
or that they can never return.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>:</td><td> </td><td align="left" valign="top">Specifying attributes of variables.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Type-Attributes.html#Type-Attributes">Type Attributes</a>:</td><td> </td><td align="left" valign="top">Specifying attributes of types.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Label-Attributes.html#Label-Attributes">Label Attributes</a>:</td><td> </td><td align="left" valign="top">Specifying attributes on labels.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Enumerator-Attributes.html#Enumerator-Attributes">Enumerator Attributes</a>:</td><td> </td><td align="left" valign="top">Specifying attributes on enumerators.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Attribute-Syntax.html#Attribute-Syntax">Attribute Syntax</a>:</td><td> </td><td align="left" valign="top">Formal syntax for attributes.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Function-Prototypes.html#Function-Prototypes">Function Prototypes</a>:</td><td> </td><td align="left" valign="top">Prototype declarations and old-style definitions.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="C_002b_002b-Comments.html#C_002b_002b-Comments">C++ Comments</a>:</td><td> </td><td align="left" valign="top">C++ comments are recognized.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Dollar-Signs.html#Dollar-Signs">Dollar Signs</a>:</td><td> </td><td align="left" valign="top">Dollar sign is allowed in identifiers.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Character-Escapes.html#Character-Escapes">Character Escapes</a>:</td><td> </td><td align="left" valign="top">‘<samp>\e</samp>’ stands for the character <tt class="key">ESC</tt>.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Alignment.html#Alignment">Alignment</a>:</td><td> </td><td align="left" valign="top">Inquiring about the alignment of a type or variable.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Inline.html#Inline">Inline</a>:</td><td> </td><td align="left" valign="top">Defining inline functions (as fast as macros).
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Volatiles.html#Volatiles">Volatiles</a>:</td><td> </td><td align="left" valign="top">What constitutes an access to a volatile object.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Using-Assembly-Language-with-C.html#Using-Assembly-Language-with-C">Using Assembly Language with C</a>:</td><td> </td><td align="left" valign="top">Instructions and extensions for interfacing C with assembler.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Alternate-Keywords.html#Alternate-Keywords">Alternate Keywords</a>:</td><td> </td><td align="left" valign="top"><code>__const__</code>, <code>__asm__</code>, etc., for header files.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Incomplete-Enums.html#Incomplete-Enums">Incomplete Enums</a>:</td><td> </td><td align="left" valign="top"><code>enum foo;</code>, with details to follow.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Function-Names.html#Function-Names">Function Names</a>:</td><td> </td><td align="left" valign="top">Printable strings which are the name of the current
|
|
function.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Return-Address.html#Return-Address">Return Address</a>:</td><td> </td><td align="left" valign="top">Getting the return or frame address of a function.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Vector-Extensions.html#Vector-Extensions">Vector Extensions</a>:</td><td> </td><td align="left" valign="top">Using vector instructions through built-in functions.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Offsetof.html#Offsetof">Offsetof</a>:</td><td> </td><td align="left" valign="top">Special syntax for implementing <code>offsetof</code>.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins">__sync Builtins</a>:</td><td> </td><td align="left" valign="top">Legacy built-in functions for atomic memory access.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins">__atomic Builtins</a>:</td><td> </td><td align="left" valign="top">Atomic built-in functions with memory model.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Integer-Overflow-Builtins.html#Integer-Overflow-Builtins">Integer Overflow Builtins</a>:</td><td> </td><td align="left" valign="top">Built-in functions to perform arithmetics and
|
|
arithmetic overflow checking.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="x86-specific-memory-model-extensions-for-transactional-memory.html#x86-specific-memory-model-extensions-for-transactional-memory">x86 specific memory model extensions for transactional memory</a>:</td><td> </td><td align="left" valign="top">x86 memory models.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Object-Size-Checking.html#Object-Size-Checking">Object Size Checking</a>:</td><td> </td><td align="left" valign="top">Built-in functions for limited buffer overflow
|
|
checking.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Pointer-Bounds-Checker-builtins.html#Pointer-Bounds-Checker-builtins">Pointer Bounds Checker builtins</a>:</td><td> </td><td align="left" valign="top">Built-in functions for Pointer Bounds Checker.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Cilk-Plus-Builtins.html#Cilk-Plus-Builtins">Cilk Plus Builtins</a>:</td><td> </td><td align="left" valign="top">Built-in functions for the Cilk Plus language extension.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Other-Builtins.html#Other-Builtins">Other Builtins</a>:</td><td> </td><td align="left" valign="top">Other built-in functions.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Target-Builtins.html#Target-Builtins">Target Builtins</a>:</td><td> </td><td align="left" valign="top">Built-in functions specific to particular targets.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Target-Format-Checks.html#Target-Format-Checks">Target Format Checks</a>:</td><td> </td><td align="left" valign="top">Format checks specific to particular targets.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Pragmas.html#Pragmas">Pragmas</a>:</td><td> </td><td align="left" valign="top">Pragmas accepted by GCC.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Unnamed-Fields.html#Unnamed-Fields">Unnamed Fields</a>:</td><td> </td><td align="left" valign="top">Unnamed struct/union fields within structs/unions.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Thread_002dLocal.html#Thread_002dLocal">Thread-Local</a>:</td><td> </td><td align="left" valign="top">Per-thread variables.
|
|
</td></tr>
|
|
<tr><td align="left" valign="top">• <a href="Binary-constants.html#Binary-constants">Binary constants</a>:</td><td> </td><td align="left" valign="top">Binary constants using the ‘<samp>0b</samp>’ prefix.
|
|
</td></tr>
|
|
</table>
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" accesskey="n" rel="next">C++ Extensions</a>, Previous: <a href="C_002b_002b-Implementation.html#C_002b_002b-Implementation" accesskey="p" rel="prev">C++ Implementation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|