|
|
|
Why do we use C still?
|
|
12 points
by netbyte
5165 days ago
|
|
Why do we use C still when there are other languages like Go or C++ or even D? BCPL and B were done away with so quickly, so why do we still use C in our modern society with languages that can do things a lot more efficiently? |
|
1. Everyone has a C compiler, or can write a decent-enough one to support their preferred environment.
2. C is well tested and specified. Reading the standard isn't an exercise is face melting (compare with, say, C++).
3. As a systems language, C doesn't require a runtime library if not needed, and this can be left out very easily (not the case with Go, D, or C++, as I'm aware).
4. C exposes easy trapdoors to the underlying machine (inline assembly, pointers, etc.) that are very handy.
5. C is usable by other languages, as its calling conventions are well documented. This is why C is a preferred base language for things like OpenGL bindings--it's easy to write Ruby, Pyhton, Java, etc. wrappers. This is in sharp contrast to C++, which is brainfucked for things like symbol exports.
6. A line of C is pretty obvious in what it does, when written correctly. You can usually estimate what code it'll generate, barring #define hackery. C++ especially is bad at this.
~
C is still used because it doesn't do a lot, and it nails what it does do.