4 ms·
What's wrong with being written in C++? It's a high-level, fast language with higher-level abstractions and better typesafety than C and decades of expertise bu
by koko775 11y ago
What's wrong with being written in C++? It's a high-level, fast language with higher-level abstractions and better typesafety than C and decades of expertise built up around it.
Sure, that means it has some legacy bits that need to be supported, but to some degree that's the price of having a mature codebase.
Having compiled LLVM and rooted through its internals trying to implement a plugin, it looks pretty well-architected and internally consistent. Codebases that cover as much as LLVM+Clang do being that clean is a rare sight, IMO. And it's not slow.
- pmelendez 11y ago> What's wrong with being written in C++? Many C devs love to hate C++. I guess is something like some C++ devs love to hate Java. It's a bit of a heritage issue :) C++ does the job for me... it's is almost as powerful as it is complicated but I find that a fair trade off (YMMV)
- andresmanz 11y agoActually, I love C, C++ and Java all the same. They are great tools for writing great code. But regarding the comments I've stumbled upon, I think you're right.
- fizixer 11y agoNothing wrong with C++ per se, if you're a C++ programmer. First, I assume this is a musl thread, so I'm assuming C++ people might not be interested in it in the first place (I'd be surprised if C++ communities discuss the bloat of glibc let alone seeking its minimal C alternatives like musl instead of going for C++ solutions like boost and what not). Second, having hung around people who discuss the bloat of glibc, and strive for white-box and minimalism, of which musl is a result (this includes, but not limited to, communities like suckless, and cat-v.org), speaking of musl and clang in the same line would be odd at the least, considering clang is ~600k+ lines of C/C++, when there is a C-only tcc compiler at ~60k+, so it's likely clang is doing something (a lot of things) that C programmers have no interest in. Although I should admit these minimalist C communities might not have a good opinion of Python either (that's one of my personal interests).
- Sanddancer 11y agoPart of those 600k lines of code come in the form of various things that tcc doesn't do -- things like loop unrolling, support for SSE, support for architectures other than intel-based, support C11, etc. So, you end up with a compiler that is significantly slower and less useful than the clang suite. So while there are things the C community wouldn't support, like other languages, there are quite a few things that the C community would consider vital these days.
- Solarsail 11y agoAs a (mostly ignorable) sidenote, TCC does support a couple of non-intel ISAs. At least 4-5k LOC beween arm-gen.c and C67-gen.c, compiled from an IR https://github.com/LuaDist/tcc/blob/master/il-opcodes.h https://github.com/LuaDist/tcc/blob/master/il-opcodes.h If this repository's anything to go by: https://github.com/LuaDist/tcc https://github.com/LuaDist/tcc I'm not sure how well maintained those backends are, and I've read TCC isn't really stable enough to use in production, between the incomplete x64 backend and just general bugs... Solving those may yet push TCC a fair bit beyond 60k LOC.
- plorkyeran 11y agoClang itself is ~400k once you exclude things like the static analyzer and all the various tooling built on top of it that's shipped with clang. Either way, that number is sort of a drop in the bucket compared to LLVM. LLVM is millions of lines of code, very little of which could be dropped simply by only supporting C. Even a C-only programmer wants things like optimization passes and backends for every platform they plan on running on.
- cwyers 11y agoThat's one way to look at it. Another way to look at it is that Clang/LLVM are the open source compiler that aren't under the GPL and musl is the open source libc that isn't under the GPL.