4 ms·
> What does "magically" mean to you? That by virtue of using a C compiler the code will, with no effort on my part, run faster than equivalent code written in
by atilaneves 8y ago
> What does "magically" mean to you?
That by virtue of using a C compiler the code will, with no effort on my part, run faster than equivalent code written in a different language. That, if an implementation exists in C, that no other implementation can beat it.
I'm railing on against it because I've met people who believe that first paragraph, literally.
> If I say "the C compiler has millennia of work by a small army of clever people", do you think I'm saying it's "magic"?
No. But one can use the same backends as the current C compilers for other languages. The results will be the same.
> In that section you only mention C and assembly. It is not until much later mention other AOT languages.
My bad. Sometimes things are obvious to me and I incorrectly assume that other people will get what I'm saying.
> Is that not also a myth? https://en.wikipedia.org/wiki/PDP-11_architecture#Myth_of_PD.. https://en.wikipedia.org/wiki/PDP-11_architecture#Myth_of_PD....
From the link you posted:
"However, the C programming language did take advantage of several low-level programming features of the PDP-11, resulting in their inclusion into new processor".
I'd say no to the myth question. Reasonable people may disagree.
> C was implemented for other systems within its first year
I don't doubt it. Those systems were far, far simpler than an last-gen x86 processor.
My point isn't that "it's fancy PDP11 assembly", it's that today's hardware isn't even close to being represented by C. Or, at the very least, no more so than alternatives.
I've seen a lot of people write that they can see the assembly that would be generated when they read C. I don't think they've looked at the output of a compiler in a long while if that's the case.
- eesmith 8y agoYou used 'magically' twice, so the definition you just gave is incomplete. The second use was "GC languages are magically slow." Yes, the C language took advantage of byte addressing on the PDP-11, and most computers since then support byte addressing because of C. That's hardly the same as "C maps closely to a PDP-11", which is the claim you made that I am arguing is a myth. The link I gave to http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.138.35&rep=rep1&type=pdf http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.138... describes "THE MACHINE MODEL OF UNIX". Nothing about that model is closely tied to the PDP-11 hardware, that I can tell. C-with-intrinsics does a decent job of matching the machine's instruction set, with a fallback to be able to support machines which don't support specific instructions. FWIW, no programming language, not even assembly, is able to handle "cache hiearchies, cache lines, memory prefetching, out-of-order execution, etc".