4 ms·
Author was not jumping out of the paradigm here, they were deliberately misusing constructs specialised for the paradigm (br/ret). That’s like saying the toolca
by masklinn 4y ago
Author was not jumping out of the paradigm here, they were deliberately misusing constructs specialised for the paradigm (br/ret). That’s like saying the toolcase is a specialised screw processor because you’re trying to drive nails using a screwdriver and it does not go well.
And C is hardly the first or only procedural langage.
- Nevermark 4y agoNo but C is a better model of most processors assembly, than most other procedural languages.
- masklinn 4y agoNot sure how that is relevant. The GP asserts (and bemoans) the reverse cause-and-effect.
- pjmlp 4y agoOnly when we are talking about PDP-11. Thankfully nowadays we have Compiler Explorer supporting almost every flavour of mainstream compiled languages to dispel myths.
- Nevermark 4y agoUnless you know a widely used high level language that is is a better model of newer assembly, then C would still remain “the best”, no? “Not as good lately”, doesn’t change that status without another language superseding it, right?
- flohofwoe 4y agoThis PDP-11 vs C thing always seems to come down to the PDP-11's auto-increment addressing modes vs C's ++ and --. Are there are any other PDP-11 features baked into C? Because this increment/decrement thing is hardly unique (the 68k CPUs had that too, and every CPU with a stack pointer also does it, some CPUs just made that a general addressing mode accessible in the instruction set. While today's compiler do a lot more transformations which can result in surprising output, it's still fairly straightforward to map C statements to CPU instructions.
- pjmlp 4y agoHow do you map C statements to AVX512 instructions?
- flohofwoe 4y ago...by doing the only sensible thing and use intrinsics. Auto-vectorisation is exactly where compiler optimisations stop being useful.
- pjmlp 4y agoOn which page of ISO C can I find the intrinsics specification?
- junon 4y agoNot sure what your point is. There are no instruction-level parts to the standard. The C standard doesn't dictate how individual CPUs should operate.
- tsimionescu 4y agoThe point is that C is very far away from being a "portable assembly" for any kind of modern processor. For the PDP-11 and other processors from that era, there was indeed some pretty simple 1:1 mapping between C instructions and their assembly. This has not been true for decades.
- MereInterest 4y agoThe point is in reference to flohofwoe's earlier comment which stated "it's still fairly straightforward to map C statements to CPU instructions.". By pointing out the existence of vectorized instructions, which are entirely absent from the C standard, pjmlp was making an argument by counter-example. That while you can map C statements to CPU instructions, most compilers typically don't apply such a 1-1 mapping. The seeming non-sequitur referring to the ISO C standard was because flohofwoe responded to the rhetorical question as if it were a normal question, leading pjmlp to restate the rhetorical question in a stronger form.