2 Free C Compilers Worth a Look

It’s surprising how important the C programming language remains, as it’s now over 40 years since it was first created. It’s a simple but useful language that gives you a very low level view of memory and how variables are stored. It doesn’t have any high-level libraries for hash maps or lists; ANSI C only gives you arrays and pointers. If you want advanced data structures you have to either write them yourself using pointers or get third party or open source libraries.

As a result of such simplicity, any programmer, amateur or professional can — in theory — create his own C compiler. That’s not so for C++ compilers, which are vastly different and considerably more complex. It’s like the difference between building a mud hut (C) compared to a skyscraper (C++). A C compiler takes roughly one to two man years to create, whereas a C++ compiler takes 15 to 20. In fact, it’s so hard to make one for C++ that it’s not uncommon to take a compiler front end such as Clang and just plug in a matching back end like LLVM.

Developers of other language compilers will often have them generate C code as an output. Doing so allows them effectively generate executable code without learning the subtleties of native code generation for a particular platform. Python, Perl and PHP are among the languages that have such compilers.

Even Microsoft appears to be taking a look at C after years of Visual C/Studio only supporting ANSI C. C99 has only been available through non-Microsoft Compilers, as Microsoft didn’t reckon there was any demand for it on Windows. For compiling C99, GCC, Clang or one or two others were your best hope. Finally, last year, Microsoft announced that some C99 features would make it into Visual Studio 2013.

Where C remains popular is on Linux and in embedded forms for low memory or low power processors. And given just how much Linus Torvalds loves C++, C will likely continue to be around for a long, long time.

Pelles C Is for Windows

For those who are still developing in C and want a freeware development system for Windows that supports C99 and C11 (the next version after C99), try Pelles. It’s not just a C compiler but also an IDE that includes project management tools, a debugger, a profiler, a source code editor and resource editors for dialogs, menus, string tables, accelerator tables, bitmaps, icons, cursors, animated cursors, animation videos (AVIs without sound), versions and XP manifests. Though not open source, it was developed by a single developer — Pelle Orinius — and it’s based on the Local C Compiler LCC. As its IDE goes, it’s not Visual Studio but once you get used to it, it does everything you want.

CompCert Compiler

Funded by the French National Research Agency, the CompCert C compiler is a verified compiler, a rarity. It was programmed and formally proved using Coq, an interactive theorem prover. The fact that it’s verified doesn’t mean that the C compiler will always generate perfect code — the definition of C contains a few areas where the behavior is undefined. It simply means that the C compiler requirements have been mathematically verified, proven to be correctly implemented. However, you need to know Ocaml and Coq code to understand the proof.