4 ms·
For big computers, C is good for systems programming because everyone else uses it and because of the titanic effort that has been put in to building really goo
by Nelson69 9y ago
For big computers, C is good for systems programming because everyone else uses it and because of the titanic effort that has been put in to building really good optimizing C compilers. UNIX came along but when C killed pascal, IBM, Microsoft, everybody was on C's dick.
On small embedded computers, I think C is popular because it's so easy to build something that resembles a C compiler. The fact is, undergrad compiler classes almost build C compilers (some universities might actually go all the way.) You can almost build a yacc grammar that will read C and emit assembly. The small computer embedded vendors have a difficult problem, they need to provide tooling and they don't usually have giant piles of developers to sell to. So they dust off some abandoned "C compiler" they found in the gutter, add their hardware to it and call it good. At least that's my theory and I've seen some rough "compiler work" from some pretty substantial hardware vendors. In fact, if you're running a 16bit or smaller part or a weird part, I have yet to see a decent C compiler from a hardware vendor.
- davemp 9y agoThis is a very important point. The hardware world itself suffers from this effect even more than software with synthesis and PNR for verilog/VHDL. I'm hoping the compilation world progresses enough with efforts such as LLVM to break our chains to crufty languages.
- sedachv 9y ago> You can almost build a yacc grammar that will read C and emit assembly. I have looked at a lot of C parsers and compilers and have written a C to Lisp transpiler and this statement is ludicrously wrong. You cannot even parse C code with yacc because of typedefs. The grammar of C is context-sensitive. And this is after the C code has been preprocessed, something that also cannot be done with yacc. C compilers are easy to port to different machines, but that is because C is a very poor language in terms of features and control flow constructs. For the limited amount of things that C gives you as a language it also comes with a huge amount of complicated baggage when it comes to implementation and corner cases.
- JoeAltmaier 9y agoTrue about the preprocessor. But the typedef issue is usually (trivially) solved with a link between the symbol table and the scanner.