ANSI C compliance
TCC implements all the ANSI C standard features:- Structure bit fields with full type support
- Floating point numbers (
long double,double, andfloatfully supported) - All standard data types and operations
- Complete preprocessor implementation
TCC includes a full C preprocessor, so you can use all standard preprocessor directives including
#include, #define, #ifdef, and conditional compilation.ISO C99 extensions
TinyCC implements many features of the ISO C99 standard. Currently missing items are complex and imaginary numbers.Supported ISO C99 features
Variable length arrays
Variable length arrays
VLAs allow you to declare arrays with runtime-determined sizes:
64-bit long long types
64-bit long long types
Full support for 64-bit integer types:
Boolean type
Boolean type
The
_Bool type is supported for boolean values:__func__ identifier
__func__ identifier
__func__ is a string variable containing the current function name:Variadic macros
Variadic macros
__VA_ARGS__ can be used for function-like macros with variable arguments:Additional C99 features
The
inline and restrict keywords are recognized but currently ignored by TCC.GNU C extensions
TCC implements many GNU C extensions for compatibility with GCC code.Designator extensions
Extended syntax
- Escape character:
\eis ASCII character 27 (ESC) - Case ranges: Use ranges in switch cases
Attributes
The__attribute__ keyword allows specifying variable and function attributes:
Alignment and packing
Alignment and packing
Section placement
Section placement
Calling conventions
Calling conventions
regparm(n), the first n parameters go in registers %eax, %edx, and %ecx.Other attributes
Other attributes
unused: Suppress warnings for unused variables/functionsdllexport: Export function from DLL/executable (Windows)nodecorate: Don’t apply decorations when exporting (Windows)
Advanced features
Built-in functions
TCC supports several GCC built-in functions:Inline assembly
Full support for GCC-style inline assembly with a gas-like (GNU assembler) syntax:TCC includes its own x86 inline assembler with gas-like syntax. No intermediate files are generated, and GCC 3.x named operands are supported.
TinyCC-specific extensions
Predefined macros
__TINYC__: Defined to indicate TCC is being used__TCC_BCHECK__: Defined when bounds checking is enabled (-boption)__TCC_BACKTRACE__: Defined when backtrace support is enabled (-btoption)
Script support
Binary literals
Binary digit literals are supported:Compatibility notes
Pragma support
#pragma pack is supported for Windows compatibility:
Standard version
Use-std=version to control __STDC_VERSION__:
-std=c11or-std=gnu11: Sets to201112- Otherwise: Sets to
199901