Extensions to the C Language Family#
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++.
- Statements and Declarations in Expressions
- Locally Declared Labels
- Labels as Values
- Nested Functions
- Nonlocal Gotos
- Constructing Function Calls
- Referring to a Type with typeof
- Conditionals with Omitted Operands
- 128-bit Integers
- Double-Word Integers
- Complex Numbers
- Additional Floating Types
- Half-Precision Floating Point
- Decimal Floating Types
- Hex Floats
- Fixed-Point Types
- Named Address Spaces
- Arrays of Length Zero
- Structures with No Members
- Arrays of Variable Length
- Macros with a Variable Number of Arguments.
- Slightly Looser Rules for Escaped Newlines
- Non-Lvalue Arrays May Have Subscripts
- Arithmetic on void- and Function-Pointers
- Pointer Arguments in Variadic Functions
- Pointers to Arrays with Qualifiers Work as Expected
- Non-Constant Initializers
- Compound Literals
- Designated Initializers
- Case Ranges
- Cast to a Union Type
- Mixed Declarations, Labels and Code
- Declaring Attributes of Functions
- Common Function Attributes
- AArch64 Function Attributes
- AMD GCN Function Attributes
- ARC Function Attributes
- ARM Function Attributes
- AVR Function Attributes
- Blackfin Function Attributes
- BPF Function Attributes
- C-SKY Function Attributes
- Epiphany Function Attributes
- H8/300 Function Attributes
- IA-64 Function Attributes
- M32C Function Attributes
- M32R/D Function Attributes
- m68k Function Attributes
- MCORE Function Attributes
- MeP Function Attributes
- MicroBlaze Function Attributes
- Microsoft Windows Function Attributes
- MIPS Function Attributes
- MSP430 Function Attributes
- NDS32 Function Attributes
- Nios II Function Attributes
- Nvidia PTX Function Attributes
- PowerPC Function Attributes
- RISC-V Function Attributes
- RL78 Function Attributes
- RX Function Attributes
- S/390 Function Attributes
- SH Function Attributes
- Symbian OS Function Attributes
- V850 Function Attributes
- Visium Function Attributes
- x86 Function Attributes
- Xstormy16 Function Attributes
- Specifying Attributes of Variables
- Common Variable Attributes
- ARC Variable Attributes
- AVR Variable Attributes
- Blackfin Variable Attributes
- H8/300 Variable Attributes
- IA-64 Variable Attributes
- LoongArch Variable Attributes
- M32R/D Variable Attributes
- MeP Variable Attributes
- Microsoft Windows Variable Attributes
- MSP430 Variable Attributes
- Nvidia PTX Variable Attributes
- PowerPC Variable Attributes
- RL78 Variable Attributes
- V850 Variable Attributes
- x86 Variable Attributes
- Xstormy16 Variable Attributes
- Specifying Attributes of Types
- Label Attributes
- Enumerator Attributes
- Statement Attributes
- Attribute Syntax
- Prototypes and Old-Style Function Definitions
- C++ Style Comments
- Dollar Signs in Identifier Names
- The Character ESC in Constants
- Determining the Alignment of Functions, Types or Variables
- An Inline Function is As Fast As a Macro
- When is a Volatile Object Accessed?
- How to Use Inline Assembly Language in C Code
- Basic Asm — Assembler Instructions Without Operands
- Qualifiers
- Parameters
- Remarks
- Extended Asm - Assembler Instructions with C Expression Operands
- Qualifiers
- Parameters
- Remarks
- Special format strings
- Multiple assembler dialects in asm templates
- Constraints for asm Operands
- Simple Constraints
- Multiple Alternative Constraints
- Register Class Preferences
- Constraint Modifier Characters
- Constraints for Particular Machines
- Controlling Names Used in Assembler Code
- Assembler names for data
- Assembler names for functions
- Variables in Specified Registers
- Declaring the variable
- Using the variable
- Size of an asm
- Alternate Keywords
- Incomplete enum Types
- Function Names as Strings
- Getting the Return or Frame Address of a Function
- Using Vector Instructions through Built-in Functions
- Support for offsetof
- Legacy __sync Built-in Functions for Atomic Memory Access
- Built-in Functions for Memory Model Aware Atomic Operations
- Built-in Functions to Perform Arithmetic with Overflow Checking
- x86-Specific Memory Model Extensions for Transactional Memory
- Object Size Checking Built-in Functions
- Other Built-in Functions Provided by GCC
- Built-in Functions Specific to Particular Target Machines
- AArch64 Built-in Functions
- Alpha Built-in Functions
- Altera Nios II Built-in Functions
- ARC Built-in Functions
- ARC SIMD Built-in Functions
- ARM iWMMXt Built-in Functions
- ARM C Language Extensions (ACLE)
- ARM Floating Point Status and Control Intrinsics
- ARM ARMv8-M Security Extensions
- AVR Built-in Functions
- Blackfin Built-in Functions
- BPF Built-in Functions
- FR-V Built-in Functions
- MIPS DSP Built-in Functions
- MIPS Paired-Single Support
- MIPS Loongson Built-in Functions
- MIPS SIMD Architecture (MSA) Support
- Other MIPS Built-in Functions
- MSP430 Built-in Functions
- NDS32 Built-in Functions
- picoChip Built-in Functions
- Basic PowerPC Built-in Functions
- PowerPC AltiVec/VSX Built-in Functions
- PowerPC Hardware Transactional Memory Built-in Functions
- PowerPC Atomic Memory Operation Functions
- PowerPC Matrix-Multiply Assist Built-in Functions
- PRU Built-in Functions
- RISC-V Built-in Functions
- RX Built-in Functions
- S/390 System z Built-in Functions
- SH Built-in Functions
- SPARC VIS Built-in Functions
- TI C6X Built-in Functions
- x86 Built-in Functions
- x86 Transactional Memory Intrinsics
- x86 Control-Flow Protection Intrinsics
- Format Checks Specific to Particular Target Machines
- Pragmas Accepted by GCC
- AArch64 Pragmas
- ARM Pragmas
- M32C Pragmas
- MeP Pragmas
- PRU Pragmas
- RS/6000 and PowerPC Pragmas
- S/390 Pragmas
- Darwin Pragmas
- Solaris Pragmas
- Symbol-Renaming Pragmas
- Structure-Layout Pragmas
- Weak Pragmas
- Diagnostic Pragmas
- Visibility Pragmas
- Push/Pop Macro Pragmas
- Function Specific Option Pragmas
- Loop-Specific Pragmas
- Unnamed Structure and Union Fields
- Thread-Local Storage
- Binary Constants using the 0b Prefix