3 ms·
> I stopped reading when I got to "C also operates inside of a virtual machine." Then you missed my actual explanation and description, which is described in
by steveklabnik 8y ago
> I stopped reading when I got to "C also operates inside of a virtual machine."
Then you missed my actual explanation and description, which is described in the rest of the post. Since others are also apparently confused, I'll re-state it here.
The C language is not defined in terms of hardware. The C language is defined in terms of an "abstract machine." This machine, being abstract, does not exist. "Virtual" and "abstract" are terms that are broadly speaking synonyms in general usage.
The spec even defines this in terms of an "execution environment" which can be "freestanding" or "hosted", and most C programs are, in the spec's language, running in the execution environment of C's hosted, abstract machine.
The rest of the post is exploring how this is conceptually the same, but different in details, than something like the JVM, which is what many people think of when they hear "virtual machine." As mentioned elsewhere in the thread, the sense of "virtual machine" that C uses is where LLVM gets its name from, yet people found that confusing enough that they changed the name.
This comment is also a re-statement of my point, maybe it helps: https://news.ycombinator.com/item?id=18123642 https://news.ycombinator.com/item?id=18123642
You may also argue that the abstract machine is practically insignificant. I disagree, but that's what my follow-up posts are about, so this post doesn't address this question directly at all.
Does that help?
- Shorel 8y agoThe explanation helps, but it should not be required. Virtual has shifted meaning and using that word in this context confuses everyone. Abstract is a perfectly cromulent word in this case.
- fmihaila 8y ago> Then you missed my actual explanation and description, which is described in the rest of the post. Since others are also apparently confused, I'll re-state it here. I think the confusion stems from using the word "operates", which suggests a VM that exists at runtime: > There’s just one problem with this: C also operates inside of a virtual machine. I agree with the sibling comment that in this context the term abstract machine would be better. Also, saying "C is defined in terms of an abstract machine" instead of "operates" might be better.
- steveklabnik 8y agoIn the language of the spec, it does “operate” inside the machine. Well, the spec says “execute” but that’s even more likely to be confused with a runtime thing. Additionally, and this is something I really didn’t get into, languages aren’t inherently compiled or interpreted. You could have a C interpreter.
- fmihaila 8y ago> Additionally, and this is something I really didn’t get into, languages aren’t inherently compiled or interpreted. You could have a C interpreter. Of course; I was only addressing the confusion that other posters mentioned. While one could have a C interpreter (or any interpreter), for the purposes of the article this seems to be only a marginal point. In practice, C is (almost) never run that way, but your choice of words could suggest a parallel between the C abstract machine and the Ruby or Java VMs, and I think the way usual C implementations differ from those is more informative than how they are alike. You do explain later that the C abstract machine is a compile-time construct, but many people read selectively and react immediately, as evidenced by several posts on this page.