Next: C++ Extensions, Previous: C++ Implementation, Up: Top [Contents][Index]
GNU C provides several language features not found in ISO standard C.
(The -pedantic 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
__GNUC__
, which is always defined under GCC.
These extensions are available in C and Objective-C. Most of them are also available in C++. See Extensions to the C++ Language, for extensions that apply only to C++.
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++.
• Statement Exprs | Putting statements and declarations inside expressions. | |
• Local Labels | Labels local to a block. | |
• Labels as Values | Getting pointers to labels, and computed gotos. | |
• Nested Functions | Nested function in GNU C. | |
• Nonlocal Gotos | Nonlocal gotos. | |
• Constructing Calls | Dispatching a call to another function. | |
• Typeof | typeof : referring to the type of an expression.
| |
• Conditionals | Omitting the middle operand of a ‘?:’ expression. | |
• __int128 | 128-bit integers—__int128 .
| |
• Long Long | Double-word integers—long long int .
| |
• Complex | Data types for complex numbers. | |
• Floating Types | Additional Floating Types. | |
• Half-Precision | Half-Precision Floating Point. | |
• Decimal Float | Decimal Floating Types. | |
• Hex Floats | Hexadecimal floating-point constants. | |
• Fixed-Point | Fixed-Point Types. | |
• Named Address Spaces | Named address spaces. | |
• Zero Length | Zero-length arrays. | |
• Empty Structures | Structures with no members. | |
• Variable Length | Arrays whose length is computed at run time. | |
• Variadic Macros | Macros with a variable number of arguments. | |
• Escaped Newlines | Slightly looser rules for escaped newlines. | |
• Subscripting | Any array can be subscripted, even if not an lvalue. | |
• Pointer Arith | Arithmetic on void -pointers and function pointers.
| |
• Variadic Pointer Args | Pointer arguments to variadic functions. | |
• Pointers to Arrays | Pointers to arrays with qualifiers work as expected. | |
• Initializers | Non-constant initializers. | |
• Compound Literals | Compound literals give structures, unions or arrays as values. | |
• Designated Inits | Labeling elements of initializers. | |
• Case Ranges | ‘case 1 ... 9’ and such. | |
• Cast to Union | Casting to union type from any member of the union. | |
• Mixed Declarations | Mixing declarations and code. | |
• Function Attributes | Declaring that functions have no side effects, or that they can never return. | |
• Variable Attributes | Specifying attributes of variables. | |
• Type Attributes | Specifying attributes of types. | |
• Label Attributes | Specifying attributes on labels. | |
• Enumerator Attributes | Specifying attributes on enumerators. | |
• Statement Attributes | Specifying attributes on statements. | |
• Attribute Syntax | Formal syntax for attributes. | |
• Function Prototypes | Prototype declarations and old-style definitions. | |
• C++ Comments | C++ comments are recognized. | |
• Dollar Signs | Dollar sign is allowed in identifiers. | |
• Character Escapes | ‘\e’ stands for the character ESC. | |
• Alignment | Determining the alignment of a function, type or variable. | |
• Inline | Defining inline functions (as fast as macros). | |
• Volatiles | What constitutes an access to a volatile object. | |
• Using Assembly Language with C | Instructions and extensions for interfacing C with assembler. | |
• Alternate Keywords | __const__ , __asm__ , etc., for header files.
| |
• Incomplete Enums | enum foo; , with details to follow.
| |
• Function Names | Printable strings which are the name of the current function. | |
• Return Address | Getting the return or frame address of a function. | |
• Vector Extensions | Using vector instructions through built-in functions. | |
• Offsetof | Special syntax for implementing offsetof .
| |
• __sync Builtins | Legacy built-in functions for atomic memory access. | |
• __atomic Builtins | Atomic built-in functions with memory model. | |
• Integer Overflow Builtins | Built-in functions to perform arithmetics and arithmetic overflow checking. | |
• x86 specific memory model extensions for transactional memory | x86 memory models. | |
• Object Size Checking | Built-in functions for limited buffer overflow checking. | |
• Other Builtins | Other built-in functions. | |
• Target Builtins | Built-in functions specific to particular targets. | |
• Target Format Checks | Format checks specific to particular targets. | |
• Pragmas | Pragmas accepted by GCC. | |
• Unnamed Fields | Unnamed struct/union fields within structs/unions. | |
• Thread-Local | Per-thread variables. | |
• Binary constants | Binary constants using the ‘0b’ prefix. |
Next: C++ Extensions, Previous: C++ Implementation, Up: Top [Contents][Index]