Hacker News new | ask | show | jobs
by dewster 3628 days ago
The true strength of C is being a good fit to the underlying hardware.

And hardware still very much matters, even if it's running Unix, because of binary compatibility.

I still don't get the VM thing. I mean, I get it from a portability standpoint, but in practice it's been a pretty horrible thing because a stack machine of all things is often picked as the virtual target. Why not a generic register based machine, like most hardware actually is these days? My feeling is the people doing the implementing are infected with the Forth virus, and a stack based VM is one of the few ways they can force their crazy ideas on the rest of us.

1 comments

You do understand that hardware development has been shaped by C being the defacto standard low-level language? That is, if new hardware isn't easy to code for with C it has little chance of it catching on, unless it's so incredibly low-level and minimal that ASM is the most complicated language you need.

And while I'm no compiler writer, I suspect stack machines are a great choice for modelling an intermediate language because converting it to optimal register use is fairly simple, yet at the same time is completely agnostic about how many registers an underlying machine has.

>You do understand that hardware development has been shaped by C being the defacto standard low-level language?

No, I don't understand that, and honestly have no clue what you're talking about. C is about as simple as things come, and it doesn't necessarily make strange demands on the hardware. It may seem that I'm contradicting my previous statement, but C working well with hardware doesn't necessarily mean it is a force for shaping modern hardware.

Three operand register-based load / store machines make too much sense from a variety of angles for many (any?) other configurations to touch them, that's why they're everywhere.

Stack machines are inherently less efficient, and you only see a bunch of designs (mostly as amateur soft cores) to this day because they are almost trivial to for enthusiasts to implement, not because they kick ass.

> No, I don't understand that, and honestly have no clue what you're talking about.

Clearly.

https://en.wikipedia.org/wiki/Lisp_machine#End_of_the_Lisp_m...

But we don't do this anymore, we don't build processors to cater to the particular needs of a particular high level language because we know now this approach to speeding things up is fundamentally misguided. Hardware is designed based on the types of calculations it is intended to do (DSP, GP, FP, GPU) and that's it. To do otherwise would be inefficient.