Author Topic: tcc for Windows  (Read 14346 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
tcc for Windows
« 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 (http://fabrice.bellard.free.fr/tcc/) 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: tcc for Windows
« Reply #1 on: September 01, 2005, 02:44:49 pm »
This is simply amazing  :lol:
Be patient!
This bug will be fixed soon...

takeshimiya

  • Guest
Re: tcc for Windows
« Reply #2 on: September 01, 2005, 09:58:15 pm »
 :o

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: tcc for Windows
« Reply #3 on: September 01, 2005, 10:00:09 pm »
Really impressing.

A shame it's C only but really... impressing.

takeshimiya

  • Guest
Re: tcc for Windows
« Reply #4 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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: tcc for Windows
« Reply #5 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."