1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5 <title> Tiny C Compiler Reference Documentation </title>
11 Tiny C Compiler Reference Documentation
17 TinyCC (aka TCC) is a small but very fast C compiler. Unlike other C
18 compilers, it is meant to be self-suffisant: you do not need an
19 external assembler or linker because TCC does that for you.
22 TCC compiles so fast that even for big projects <tt>Makefile</tt>s may
25 TCC can also be used to make <I>C scripts</I>,
26 i.e. pieces of C source that you run as a Perl or Python
27 script. Compilation is so fast that your script will be as fast as if
30 <h2>Exact differences with ANSI C</h2>
32 TCC implements almost all the ANSI C standard, except floating points
36 <li> The preprocessor tokens are the same as C. It means that in some
37 rare cases, preprocessed numbers are not handled exactly as in ANSI
38 C. This approach has the advantage of being simpler and FAST!
40 <li> Floating point numbers are not fully supported yet (some
41 implicit casts are missing).
43 <li> Some typing errors are not signaled.
46 <h2>ISOC99 extensions</h2>
48 TCC implements many features of the new C standard: ISO C99. Currently
49 missing items are: complex and imaginary numbers (will come with ANSI
50 C floating point numbers), <tt>long long</tt>s and variable length
53 Currently implemented ISOC99 features:
57 <li> <tt>'inline'</tt> keyword is ignored.
59 <li> <tt>'restrict'</tt> keyword is ignored.
61 <li> <tt>'__func__'</tt> is a string variable containing the current
64 <li> Variadic macros: <tt>__VA_ARGS__</tt> can be used for
67 #define dprintf(level, __VA_ARGS__) printf(__VA_ARGS__)
69 <tt>dprintf</tt> can then be used with a variable number of parameters.
71 <li> Declarations can appear anywhere in a block as in C++.
73 <li> Array and struct/union elements can be initialized in any order by
76 struct { int x, y; } st[10] = { [0].x = 1, [0].y = 2 };
78 int tab[10] = { 1, 2, [5] = 5, [9] = 9};
81 <li> Compound initializers are supported:
83 int *p = (int []){ 1, 2, 3 };
85 to initialize a pointer pointing to an initialized array. The same
86 works for structures and strings.
88 <li> The boolean type <tt>'_Bool'</tt> is supported.
90 <li> <tt>'long long'</tt> types not supported yet, except in type
91 definition or <tt>'sizeof'</tt>.
93 <li> Hexadecimal floating point constants are supported:
97 is the same as writing
103 <h2>GNU C extensions</h2>
105 TCC implements some GNU C extensions which are found in many C sources:
109 <li> array designators can be used without '=':
111 int a[10] = { [0] 1, [5] 2, 3, 4 };
114 <li> Structure field designators can be a label:
116 struct { int x, y; } st = { x: 1, y: 1};
120 struct { int x, y; } st = { .x = 1, .y = 1};
123 <li> <tt>'\e'</tt> is ASCII character 27.
127 <h2>TinyCC extensions</h2>
129 I have added some extensions I find interesting:
133 <li> <tt>__TINYC__</tt> is a predefined macro to <tt>'1'</tt> to
134 indicate that you use TCC.
136 <li> <tt>'#!'</tt> at the start of a line is ignored to allow scripting.
138 <li> Binary digits can be entered (<tt>'0b101'</tt> instead of
143 <h2> Command line invokation </h2>
146 usage: tcc [-Idir] [-Dsym] [-llib] [-i infile] infile [infile_args...]
151 <td>specify an additionnal include path. The default ones are:
152 /usr/include, /usr/lib/tcc, /usr/local/lib/tcc.</td>
155 <td>define preprocessor symbol 'sym' to 1.</td>
158 <td>dynamically link your program with library
159 libxxx.so. Standard library paths are checked, including those
160 specificed with LD_LIBRARY_PATH.</td>
162 <tr><td>'-i file'</td>
163 <td>compile C source 'file' before main C source. With this
164 command, multiple C files can be compiled and linked together.</td>
168 Copyright (c) 2001 Fabrice Bellard <hr>
169 Fabrice Bellard - <em> fabrice.bellard at free.fr </em> - <A HREF="http://fabrice.bellard.free.fr/"> http://fabrice.bellard.free.fr/ </A> - <A HREF="http://www.tinycc.org/"> http://www.tinycc.org/ </A>