Joca, this is a stupid question, there are not many production ready C
compilers. Obvious answer is gcc, then clang (may depend on ecosystem too, I
think Apple likes clang more?). Zig's compiler is great too (currently LLVM
based, so I'm not too sure if there's a huge difference between it and clang
other than the AMAZING cross compilation.)
Since I've clarified the stupidity of such question, I'd like to answer a
different question: What are some interesting C compilers?
Here's a list:
-
https://github.com/xorvoid/sectorc - supports a subset of C, and can fit in a
boot sector (512 bytes)
-
https://github.com/Battelle/movfuscator - compiles into only mov
instructions. Fascinating.
-
https://bellard.org/otcc/otcc.c - "Obfuscated Tiny C Compiler". Only
generates i386 asm. It's 2048 bytes! Of course, only compiles a subset.
-
https://github.com/cksystemsteaching/selfie - Particularly cool because it's
a single 12k LoC file that is *very* well organized and is used for teaching
a few things: 1) compilers, 2) RISC-V architecture, 3) VMs! That said, it
implements a compiler to RISC-V, and a VM that emulates RISC-V! Also, it
compiles a *subset* of C.
Some more ordinary but still interesting ones are:
-
https://bellard.org/tcc/ - based on otcc. Amazingly fast, not actively maintained
anymore (however that doesn't mean it's not great. It can compile many
projects. There are some forks out there providing extra features.)
-
https://github.com/RealNeGate/Cuik - Modern C compiler written in.. C. Not
very ready. I think the person who made this is really young? I dont
remember, I was half asleep watching the Tsoding video about it.
-
https://github.com/Vexu/arocc - written in Zig, looks cool, haven't tried.