← Back to context

Comment by stackghost

3 hours ago

> C just minimally reflects how computers work. The rest is just convention.

This hasn't been true for decades. x86 assembly is now itself an abstraction over what the CPU is actually doing.

Microcode, speculative execution, etc.

It seems to be a meme on HN that C doesn't reflect hardware, now you're extending that to assembly. It seems silly to me. It was always an approximation of what happens under the hood, but I think the concepts of pointers, variable sizes and memory layout of structs all represent the machine at some level.

  • > the concepts of pointers, variable sizes and memory layout of structs all represent the machine at some level.

    Exactly.

    Everything in assembly is still one-to-one in terms of functional/stateful behavior to actual execution. Runtime hardware optimization (pinhole instruction decomposition and reordering, speculative branching, automated caching, etc.) give a performance boost but do not change the model. Doing so would mean it didn't work!

    And C is still very close to the assembly, in terms of basic operations. Even if a compiler is able to map the same C operations to different instructions (i.e. regular, SIMD, etc.)

    • Lets play a game of what ISO C can do, and no other systems programming language has similar feature available?

      If language extensions to ISO C are allowed, then same goes for my selection on competing systems languages.