4 ms·
Here's why: C is dang near as close to the hardware as you can get without touching it, it runs everywhere, and it has so little abstraction that it's hard to i
by qwertyuiop924 10y ago
Here's why: C is dang near as close to the hardware as you can get without touching it, it runs everywhere, and it has so little abstraction that it's hard to incur unexpected costs. Rust is closer to C++ here, and the other languages on your list are so far outside the ballpark that they can't even touch the edge of it.
It's not the only language of this sort, but C also has a lot of code written in it, which is a major advantage.
- lmm 10y ago> C is dang near as close to the hardware as you can get without touching it Not really true in the context of the optimizations done by modern C compilers (e.g. autovectorization).
- qwertyuiop924 10y agoIn some ways. But, as I discussed (dragonwriter brought it up) in a cousin comment, C still does direct hardware access better than most other 3GLs. And that matters sometimes.
- dragonwriter 10y ago> C is dang near as close to the hardware as you can get without touching it Not really; it's structurally nothing like assembly, which is as close as you can get to the hardware without just handcoding machine code. Now, C -- for a structured language with static typing -- provides very little in terms of safety features that get in the way of direct hardware manipulation, whereas lots of languages with superficially similar structure aim to be safe in some ways by default which makes some hardware manipulation more difficult, or at least more verbose, than it would be in C. So, in some ways it gets less in the way of freedom to manipulate the hardware than some other structured programming languages. But it's not particularly close to the hardware at all.
- qwertyuiop924 10y ago>Not really; it's structurally nothing like assembly, which is as close as you can get to the hardware without just handcoding machine code. Here, assembly is touching the hardware. If you write your code in assembly, it's not portable to other architectures, even hypothetically. >provides very little in terms of safety features that get in the way of direct hardware manipulation Exactly. So it's a heck of a lot closer to the hardware than most 3GLs.
- nickpsecurity 10y agoTo support your argument, p-code is closer to what a portable, assembly language looks like. It's an abstract machine that can be trivially targeted to about any CISC or RISC machine. Let amateurs without compiler knowledge port Pascal/P to around 70 architectures in 2 years. https://en.wikipedia.org/wiki/P-code_machine https://en.wikipedia.org/wiki/P-code_machine Linoleum was another: http://anynowhere.com/bb/layout/html/frameset.html http://anynowhere.com/bb/layout/html/frameset.html The closest in C land was C-- by Jones et al which still looks heavy compared to p-code: http://www.cs.tufts.edu/~nr/c--/index.html http://www.cs.tufts.edu/~nr/c--/index.html
- dbaupp 10y agoC itself isn't that close. Vendor extensions and relying on the compiler to pattern match certain code are needed to get access to actual hardware features, like, for instance, rotating the bits of an integer, vector instructions and efficient integer overflow detection.