3 ms·
> C having better support for pointers make it near to how the processor works, compared to other languages. Java is almost entirely pointers to heap allocatio
by hmfrh 4y ago
> C having better support for pointers make it near to how the processor works, compared to other languages.
Java is almost entirely pointers to heap allocations, yet I don't think anyone would argue that Java is close to how the processor works.
I also don't think that the C virtual machine is all that close to how machines actually work any more.
- anthomtb 4y agoC has a virtual machine? Do tell more.
- hmfrh 4y agoIt appears to also be called the "abstract machine"[1]. C semantics do not work "directly on the hardware" but instead on an abstract machine that is then converted to the actual hardware. It most often comes up when talking about undefined behavior and pointer behavior. Some assorted reading, mostly in the context of Rust and C: https://blog.regehr.org/archives/213 https://blog.regehr.org/archives/213 https://raphlinus.github.io/programming/rust/2018/08/17/undefined-behavior.html https://raphlinus.github.io/programming/rust/2018/08/17/unde... https://www.ralfj.de/blog/2018/07/24/pointers-and-bytes.html https://www.ralfj.de/blog/2018/07/24/pointers-and-bytes.html https://www.ralfj.de/blog/2017/06/06/MIR-semantics.html https://www.ralfj.de/blog/2017/06/06/MIR-semantics.html [1]: https://stackoverflow.com/questions/53100198/what-is-the-precise-relationship-between-c-and-its-abstract-machine https://stackoverflow.com/questions/53100198/what-is-the-pre...
- habibur 4y agoTo be fair, Assembly once worked directly on the hardware. On modern machines it doesn't.
- whimsicalism 4y agoI don't think it is fair to conflate the "abstract machine" of C with the virtual machine. There is no software virtualization at work when running C code, it is compiled directly to assembly.
- deleted 4y ago[deleted]