Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: thomas on September 01, 2005, 02:29:23 pm

Title: tcc for Windows
Post by: thomas on September 01, 2005, 02:29:23 pm
This is actually old news (June 17), but I only saw it today, and thought this is a must-share.

tcc, the tiny c compiler ( supports Windows in its present release.
This means that the coolest ever C compiler is no longer useless. While in the past, it was a nice toy for Linux only, it now runs both on Linux and on Windows. Blatantly speaking, this means you now have a scripting language at your hands which uses C syntax and runs as fast as a C program (it is a C program!).

If you don't know tcc yet, you may ask "Why is tcc cool?" and "What about scripting language?".
First, tcc is cool because it is a really small and fast (5-10 times faster than gcc) plain normal standard C compiler. However, unlike a "normal" C compiler, it can also transparently run C programs from source! So, under Linux, you would add a usual shebang like #!/usr/local/bin/tcc -run to a C source, set the file permissions to executable, and you could run your C source just like a Perl script. With one difference: your C source would run as an optimized binary :)

Compiling tcc is almost too easy:
Download and unpack, start MSYS, go to tcc's folder, and do a ./configure ; make ; make install.

The whole compilation takes about 3 seconds. No, don't look for compiler errors, it really finishes in that time :)
Try it out... go to the tcc install directory, type tcc -run examples\hello_win.c and see the magic work.

The only drawback of tcc is that it does not do C++, but well... after all, it is a C compiler. You can't have everything.
Title: Re: tcc for Windows
Post by: mandrav on September 01, 2005, 02:44:49 pm
This is simply amazing  :lol:
Title: Re: tcc for Windows
Post by: takeshi miya on September 01, 2005, 09:58:15 pm
Title: Re: tcc for Windows
Post by: Ceniza on September 01, 2005, 10:00:09 pm
Really impressing.

A shame it's C only but really... impressing.
Title: Re: tcc for Windows
Post by: takeshi miya on September 02, 2005, 01:18:03 am
On the links, I found Lightweight C++

"Lightweight C++ is a programming language that looks like C++ (a lightweight C++ dialect) and is directly translated to readable C by the lwc preprocessor. It's more "K&R" and, well, more lightweight. Important thing about lightweight C++ is that by studying the generated C code it is easy to understand how OOP features are implemented and what is the cost of everything."

You do the C++ -> C conversion and then you can use it with tcc.

Too bad it currently works on *nix only.
Title: Re: tcc for Windows
Post by: thomas on September 02, 2005, 05:25:35 pm
Had seen that, too. Problem with Lightweight C++ is that is it something, but not C++.
It looks somehow like C++, but then Java looks like C++ somehow, too, doesn't it :)
Personally, I perceive their syntax as confusing because it is almost like C++ yet different.