5 ms·
Not to be confused with https://bellard.org/tcc/ https://bellard.org/tcc/, which is a tiny compiler for the C language.
by ttvecthrowaway 4y ago
Not to be confused with https://bellard.org/tcc/ https://bellard.org/tcc/, which is a tiny compiler for the C language.
- squarefoot 4y agoIt is sad that tcc is unmaintained as it would be really useful in small embedded systems. I just tried it on Debian and compilation fails without #undefining CONFIG_TCC_MALLOC_HOOKS in lib/bcheck.c. After compilation it passes tests, but they warn that it could be unreliable.
- jart 4y agoTry chibicc. It's x86_64 native and so much more readable as a codebase than TCC.
- dantrell 4y agoWhile Fabrice Bellard is no longer working on TCC [0] and an official release tarball hasn't been packaged since version 0.9.27 (5 years ago) the project is by no means unmaintained. For details, check their current working repository [1] and mailing list [2]. [0]: https://bellard.org/tcc/ https://bellard.org/tcc/ [1]: https://repo.or.cz/tinycc.git https://repo.or.cz/tinycc.git [2]: https://lists.nongnu.org/archive/html/tinycc-devel/ https://lists.nongnu.org/archive/html/tinycc-devel/
- siliconunit 4y agoI'm quite confused, not the same project at all? To me tiny c compiler always meant the bellard page. Super useful stuff for micro hacky projects.
- Narishma 4y agoThis is a compiler for a language called Tiny-C.
- hawski 4y agoOne could say that the one from this submission is Tiny-C Compiler and Bellard's is Tiny C-Compiler.
- notorandit 4y agoI understand the confusion: it is more about "syntax associativity" (tiny C) compiler --> "This is a compiler for the Tiny-C language" vs Tiny (C compiler) --> "TinyCC [...] is a small but hyper fast C compiler" That's it! ;-)
- moffkalast 4y agoNow obviously the next step is to make a tiny tiny c compiler compiler.
- Laaas 4y agoI use tcc for all of my small C "scripts" for doing ioctls, etc. Less bloat, suckless. I imagine most software would be better off using tcc than gcc/clang. Performance isn't that important in most cases.
- circuit10 4y agoI feel like a lot of software written in C is written in C for performance reasons. Obviously that’s not always the case and TCC is useful but I wouldn’t say that that most software should use it
- t-3 4y agoC is usually the path of least resistance on *nix, if you're trying to interact with the OS. The docs give you C prototypes and C examples, and the source is mostly C, several standard directories are filled with C code and libraries compiled from C.
- doublepg23 4y ago> Performance isn't that important in most cases. Optimizing for storage space is…better?
- vidarh 4y agoSince they say "scripts", note that tcc supports being invoked in the shebang line. E.g. #!/usr/bin/tcc -run You can do that with gcc/clang too (e.g. #if 0, #endif to wrap a block of shell script to compile the current file and execute the result) but a primary value of tcc is that it compiles fast. On a more philosophical note, the suckless approach is to optimise for simplicity not storage. It's perfectly valid to disagree with that of course, but if simplicitly of the system as a whole is a consideration gcc and clang doesn't really fit.
- LukeShu 4y agoYou can only sort of do that with gcc/clang. The #if 0 trick relies on funny behavior that is in a few common shells. When you try to execve(2) a script without a proper #! shebang, the kernel will return ENOEXEC. Bash will check for ENOEXEC then check a few heuristics to see if it looks like a text file, and if it does, then it will try to run it as a shell script. This means that your script will work when run from a shell, but won't work when exec()ed from a non-shell program, which is a weird foot-gun.