See "C is not a low-level language" - https://queue.acm.org/detail.cfm?id=3212479
See "C is not a low-level language" - https://queue.acm.org/detail.cfm?id=3212479
C, as an operating system implementation language, is trying to do something fundamentally different than Fortran.
You live by memory address, you die by memory address.
This would also be true for assembly, hardly a high level language
I expect the hardware to handle cache coherency in that situation. What the compiler does should be irrelevant.
So maybe it's accurate to say that C is "more compatible" with real hardware, in the sense that its abstract machine is more isomorphic to what's really happening than Fortran's is. But it's not exactly "closer to hardware" in the way we might be tempted to think; it's more of a lingua franca that your processor happens to speak.
If you're still tempted to consider C "close to hardware", consider that you can compile the same code for a Z80 and a Threadripper. What hardware exactly are you controlling that's common to both?
As PhilipRoman said, this is also true of assembly (or any other programming language model[1]).
> If you're still tempted to consider C "close to hardware", consider that you can compile the same code for a Z80 and a Threadripper. What hardware exactly are you controlling that's common to both?
In both of them I can write to a memory-mapped I/O device, if it has one. I can write a custom memory allocator for a pool that I'm managing myself. I can't do either of those in Fortran or Javascript.
[1] Why does it have to be true of any other programming language model? Well, maybe I exaggerate slightly. But can you show me a (single threaded) programming language where "a = 1" does not mean that on the next line, a will be 1?
Generally agree with your point, but just to play the devil's advocate, in a CPU with exposed pipeline and no interlocks, setting a register to a value doesn't guarantee that a following instruction reading from that register will see the last value written.
MIPS I.