You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
11 KiB
HTML

<html lang="en">
<head>
<title>C Extensions - Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="C_002b_002b-Implementation.html#C_002b_002b-Implementation" title="C++ Implementation">
<link rel="next" href="C_002b_002b-Extensions.html#C_002b_002b-Extensions" title="C++ Extensions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2015 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.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="C-Extensions"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="C_002b_002b-Extensions.html#C_002b_002b-Extensions">C++ Extensions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="C_002b_002b-Implementation.html#C_002b_002b-Implementation">C++ Implementation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">6 Extensions to the C Language Family</h2>
<p><a name="index-extensions_002c-C-language-2865"></a><a name="index-C-language-extensions-2866"></a>
<a name="index-pedantic-2867"></a>GNU C provides several language features not found in ISO standard C.
(The <samp><span class="option">-pedantic</span></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>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>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++.
<ul class="menu">
<li><a accesskey="1" href="Statement-Exprs.html#Statement-Exprs">Statement Exprs</a>: Putting statements and declarations inside expressions.
<li><a accesskey="2" href="Local-Labels.html#Local-Labels">Local Labels</a>: Labels local to a block.
<li><a accesskey="3" href="Labels-as-Values.html#Labels-as-Values">Labels as Values</a>: Getting pointers to labels, and computed gotos.
<li><a accesskey="4" href="Nested-Functions.html#Nested-Functions">Nested Functions</a>: As in Algol and Pascal, lexical scoping of functions.
<li><a accesskey="5" href="Constructing-Calls.html#Constructing-Calls">Constructing Calls</a>: Dispatching a call to another function.
<li><a accesskey="6" href="Typeof.html#Typeof">Typeof</a>: <code>typeof</code>: referring to the type of an expression.
<li><a accesskey="7" href="Conditionals.html#Conditionals">Conditionals</a>: Omitting the middle operand of a &lsquo;<samp><span class="samp">?:</span></samp>&rsquo; expression.
<li><a accesskey="8" href="_005f_005fint128.html#g_t_005f_005fint128">__int128</a>: 128-bit integers---<code>__int128</code>.
<li><a accesskey="9" href="Long-Long.html#Long-Long">Long Long</a>: Double-word integers---<code>long long int</code>.
<li><a href="Complex.html#Complex">Complex</a>: Data types for complex numbers.
<li><a href="Floating-Types.html#Floating-Types">Floating Types</a>: Additional Floating Types.
<li><a href="Half_002dPrecision.html#Half_002dPrecision">Half-Precision</a>: Half-Precision Floating Point.
<li><a href="Decimal-Float.html#Decimal-Float">Decimal Float</a>: Decimal Floating Types.
<li><a href="Hex-Floats.html#Hex-Floats">Hex Floats</a>: Hexadecimal floating-point constants.
<li><a href="Fixed_002dPoint.html#Fixed_002dPoint">Fixed-Point</a>: Fixed-Point Types.
<li><a href="Named-Address-Spaces.html#Named-Address-Spaces">Named Address Spaces</a>: Named address spaces.
<li><a href="Zero-Length.html#Zero-Length">Zero Length</a>: Zero-length arrays.
<li><a href="Empty-Structures.html#Empty-Structures">Empty Structures</a>: Structures with no members.
<li><a href="Variable-Length.html#Variable-Length">Variable Length</a>: Arrays whose length is computed at run time.
<li><a href="Variadic-Macros.html#Variadic-Macros">Variadic Macros</a>: Macros with a variable number of arguments.
<li><a href="Escaped-Newlines.html#Escaped-Newlines">Escaped Newlines</a>: Slightly looser rules for escaped newlines.
<li><a href="Subscripting.html#Subscripting">Subscripting</a>: Any array can be subscripted, even if not an lvalue.
<li><a href="Pointer-Arith.html#Pointer-Arith">Pointer Arith</a>: Arithmetic on <code>void</code>-pointers and function pointers.
<li><a href="Pointers-to-Arrays.html#Pointers-to-Arrays">Pointers to Arrays</a>: Pointers to arrays with qualifiers work as expected.
<li><a href="Initializers.html#Initializers">Initializers</a>: Non-constant initializers.
<li><a href="Compound-Literals.html#Compound-Literals">Compound Literals</a>: Compound literals give structures, unions
or arrays as values.
<li><a href="Designated-Inits.html#Designated-Inits">Designated Inits</a>: Labeling elements of initializers.
<li><a href="Case-Ranges.html#Case-Ranges">Case Ranges</a>: `case 1 ... 9' and such.
<li><a href="Cast-to-Union.html#Cast-to-Union">Cast to Union</a>: Casting to union type from any member of the union.
<li><a href="Mixed-Declarations.html#Mixed-Declarations">Mixed Declarations</a>: Mixing declarations and code.
<li><a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>: Declaring that functions have no side effects,
or that they can never return.
<li><a href="Label-Attributes.html#Label-Attributes">Label Attributes</a>: Specifying attributes on labels.
<li><a href="Attribute-Syntax.html#Attribute-Syntax">Attribute Syntax</a>: Formal syntax for attributes.
<li><a href="Function-Prototypes.html#Function-Prototypes">Function Prototypes</a>: Prototype declarations and old-style definitions.
<li><a href="C_002b_002b-Comments.html#C_002b_002b-Comments">C++ Comments</a>: C++ comments are recognized.
<li><a href="Dollar-Signs.html#Dollar-Signs">Dollar Signs</a>: Dollar sign is allowed in identifiers.
<li><a href="Character-Escapes.html#Character-Escapes">Character Escapes</a>: &lsquo;<samp><span class="samp">\e</span></samp>&rsquo; stands for the character &lt;ESC&gt;.
<li><a href="Variable-Attributes.html#Variable-Attributes">Variable Attributes</a>: Specifying attributes of variables.
<li><a href="Type-Attributes.html#Type-Attributes">Type Attributes</a>: Specifying attributes of types.
<li><a href="Alignment.html#Alignment">Alignment</a>: Inquiring about the alignment of a type or variable.
<li><a href="Inline.html#Inline">Inline</a>: Defining inline functions (as fast as macros).
<li><a href="Volatiles.html#Volatiles">Volatiles</a>: What constitutes an access to a volatile object.
<li><a href="Using-Assembly-Language-with-C.html#Using-Assembly-Language-with-C">Using Assembly Language with C</a>: Instructions and extensions for interfacing C with assembler.
<li><a href="Alternate-Keywords.html#Alternate-Keywords">Alternate Keywords</a>: <code>__const__</code>, <code>__asm__</code>, etc., for header files.
<li><a href="Incomplete-Enums.html#Incomplete-Enums">Incomplete Enums</a>: <code>enum foo;</code>, with details to follow.
<li><a href="Function-Names.html#Function-Names">Function Names</a>: Printable strings which are the name of the current
function.
<li><a href="Return-Address.html#Return-Address">Return Address</a>: Getting the return or frame address of a function.
<li><a href="Vector-Extensions.html#Vector-Extensions">Vector Extensions</a>: Using vector instructions through built-in functions.
<li><a href="Offsetof.html#Offsetof">Offsetof</a>: Special syntax for implementing <code>offsetof</code>.
<li><a href="_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins">__sync Builtins</a>: Legacy built-in functions for atomic memory access.
<li><a href="_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins">__atomic Builtins</a>: Atomic built-in functions with memory model.
<li><a href="Integer-Overflow-Builtins.html#Integer-Overflow-Builtins">Integer Overflow Builtins</a>: Built-in functions to perform arithmetics and
arithmetic overflow checking.
<li><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>: x86 memory models.
<li><a href="Object-Size-Checking.html#Object-Size-Checking">Object Size Checking</a>: Built-in functions for limited buffer overflow
checking.
<li><a href="Pointer-Bounds-Checker-builtins.html#Pointer-Bounds-Checker-builtins">Pointer Bounds Checker builtins</a>: Built-in functions for Pointer Bounds Checker.
<li><a href="Cilk-Plus-Builtins.html#Cilk-Plus-Builtins">Cilk Plus Builtins</a>: Built-in functions for the Cilk Plus language extension.
<li><a href="Other-Builtins.html#Other-Builtins">Other Builtins</a>: Other built-in functions.
<li><a href="Target-Builtins.html#Target-Builtins">Target Builtins</a>: Built-in functions specific to particular targets.
<li><a href="Target-Format-Checks.html#Target-Format-Checks">Target Format Checks</a>: Format checks specific to particular targets.
<li><a href="Pragmas.html#Pragmas">Pragmas</a>: Pragmas accepted by GCC.
<li><a href="Unnamed-Fields.html#Unnamed-Fields">Unnamed Fields</a>: Unnamed struct/union fields within structs/unions.
<li><a href="Thread_002dLocal.html#Thread_002dLocal">Thread-Local</a>: Per-thread variables.
<li><a href="Binary-constants.html#Binary-constants">Binary constants</a>: Binary constants using the &lsquo;<samp><span class="samp">0b</span></samp>&rsquo; prefix.
</ul>
</body></html>