Tiny C Compiler
Source: Hacker News

Tiny C Compiler
News
I am no longer working on TCC. Check the mailing list for up‑to‑date information.
Features
- SMALL! Compile and execute C code everywhere (e.g., on rescue disks). The x86 TCC executable is about 100 KB and includes the preprocessor, compiler, assembler, and linker.
- FAST! Generates native x86 code with no byte‑code overhead. Compilation, assembly, and linking are several times faster than GCC.
- UNLIMITED! Any C dynamic library can be used directly. TCC is moving toward full ISO C99 compliance and can even compile itself.
- SAFE! Optional memory and bounds checker; checked code can be mixed freely with standard code.
- Compile and execute C source directly—no separate linking or assembly step required. Full C preprocessor and GNU‑like assembler are included.
- C scripts are supported: add
#!/usr/local/bin/tcc -runas the first line of a C source file and run it directly from the command line. - With
libtcc, TCC can be used as a backend for dynamic code generation.
Download
Compilation Speed
TCC is roughly 9 × faster than GCC for the Links Browser project.
| Compiler | Version | Time (s) | Lines/second | MB/s |
|---|---|---|---|---|
| TinyCC | 0.9.22 | 2.27 | 859 000 | 29.6 |
| GCC | 3.2 ‑O0 | 20.0 | 98 000 | 3.4 |
The project contains 76 936 lines (including headers). Because the same headers are included in many files, 1 950 947 lines (67.2 MB) are actually compiled. Measurements were taken on a 2.4 GHz Pentium 4; real time includes compilation, assembly, and linking.
More recent tests:
Online Documentation
You Want to Help?
- Report bugs to the mailing list (and eventually fix them).
Links
- TinyCC mailing list
- Savannah project page and Git repository
- OTCC – the smallest self‑compiling pseudo C compiler
- FFASN1 – a small but powerful ASN.1 compiler
- LLVM Compiler Infrastructure
- SmartEiffel – compile Eiffel code faster with TCC
- The GNU C Compiler (GCC)
- The LCC Compiler
- The Small Device C Compiler (SDCC)
- Cyclone – a safe dialect of C
- The D language
- Programming in C
- Scriptometer – evaluates various scripting languages (including TCC)
License
TCC is distributed under the GNU Lesser General Public License.
© 2001‑2018 Fabrice Bellard
Fabrice Bellard – TCC page