RTEMS GNU Tools On-Line Library
C Extensions
Using and Porting the GNU Compiler Collection (GCC)
Chapter 4: Extensions to the C Language Family
GNU C provides several language features not found in ANSI standard C.
(The `-pedantic
' option directs GNU CC 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 GNU CC.
These extensions are available in C and Objective C. Most of them are
also available in C++. See C++ Extensions , for extensions that apply only to C++.
Statement Exprs
Putting statements and declarations inside expressions.
Local Labels
Labels local to a statement-expression.
Labels as Values
Getting pointers to labels, and computed gotos.
Nested Functions
As in Algol and Pascal, lexical scoping of functions.
Constructing Calls
Dispatching a call to another function.
Naming Types
Giving a name to the type of some expression.
Typeof
typeof
: referring to the type of an expression.
Lvalues
Using `?:
', `,
' and casts in lvalues.
Conditionals
Omitting the middle operand of a `?:
' expression.
Long Long
Double-word integers---long long int
.
Complex
Data types for complex numbers.
Hex Floats
Hexadecimal floating-point constants.
Zero Length
Zero-length arrays.
Variable Length
Arrays whose length is computed at run time.
Macro Varargs
Macros with variable number of arguments.
Subscripting
Any array can be subscripted, even if not an lvalue.
Pointer Arith
Arithmetic on void
-pointers and function pointers.
Initializers
Non-constant initializers.
Constructors
Constructor expressions give structures, unions
or arrays as values.
Labeled Elements
Labeling elements of initializers.
Cast to Union
Casting to union type from any member of the union.
Case Ranges
`case 1 ... 9' and such.
Function Attributes
Declaring that functions have no side effects,
or that they can never return.
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
.
Variable Attributes
Specifying attributes of variables.
Type Attributes
Specifying attributes of types.
Alignment
Inquiring about the alignment of a type or variable.
Inline
Defining inline functions (as fast as macros).
Extended Asm
Assembler instructions with C expressions as operands.
(With them you can define ``built-in'' functions.)
Asm Labels
Specifying the assembler name to use for a C symbol.
Explicit Reg Vars
Defining variables residing in specified registers.
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.
Other Builtins
Other built-in functions.
Deprecated Features
Things might disappear from g++.
Using and Porting the GNU Compiler Collection (GCC)
Packaging copyright © 1988-2000 OAR Corporation
Context copyright by each document's author. See Free Software Foundation for information.