5 ms·
Madhadron, you make a lot of claims but provide no detail. Also using terms like "virtual machine" with respect to C is plainly ridiculous and a case of bullshi
by SeanDav 14y ago
Madhadron, you make a lot of claims but provide no detail. Also using terms like "virtual machine" with respect to C is plainly ridiculous and a case of bullshit baffles brains.
Turbo Pascal vs C? Really? In its time Turbo Pascal was an amazing piece of software but in the grand scheme of things it is a pimple compared to the whale that is C. Please compare all software written in Turbo Pascal as opposed to C if you have any doubts. The same goes for Smalltalk, Lisp, Algol 60/68. All great products/languages but very niche.
Fortran can be faster than C in some areas but again it is a niche language.
I could go on a lot more but quite frankly I don't think your post merits much more discussion and is borderline trollish.
- stephencanon 14y agoI believe he actually intends to talk about the C abstract machine, which is a well-defined technical term (and is actually used extensively in the C standard).
- eropple 14y ago> Madhadron, you make a lot of claims but provide no detail. Also using terms like "virtual machine" with respect to C is plainly ridiculous and a case of bullshit baffles brains. C as a very thin virtual machine is a common conception and not an incorrect one--C runs on many systems with noncontiguous memory segments but presents it as a single contiguous space, for example. The idea of C as a virtual machine is much of the basis of LLVM, and to the best of my knowledge I've never worked on a computer where C represented the underlying hardware without significant abstractions. If you're going to accuse somebody of trolling, you should know what you're talking about first.
- smosher 14y agoC as a very thin virtual machine is a common conception and not an incorrect one--C runs on many systems with noncontiguous memory segments but presents it as a single contiguous space, for example. C does no such thing. That is the job of the MMU, and C has nothing to say about it. You're going to have a hard time convincing anyone that a language without a runtime somehow has a VM. That's nonsense.
- scott_s 14y agoSee the above discussion about what he meant by "virtual machine." It's not what you think it is, and it does exist.
- smosher 14y agoIt doesn't matter, his description is still the same kind of nonsense in line with having a VM. I get the feeling that he thought the thing he meant to say is actually the thing he said.
- scott_s 14y agoSorry, I don't see that. What he said is clear to me: The C virtual machine does not provide an accurate model of why your code is fast on a modern machine. He's saying that the abstraction that C provides has deviated significantly from the underlying hardware. Considering the kinds of hoops that modern processor go through, this is a valid point. And the above should answer the sibling's question, too.
- smosher 14y agoSorry, I don't see that. Try reading the part I quoted. I think you're conflating my criticisms with that of someone else. Yes, C abstracts the hardware, and always has. That's the point I made in the first place: its memory abstraction is a prerequisite. Hardware and operating systems provide that to C, in direct contradiction to the comment I replied to (which claims C provides it.)
- tedunangst 14y agoHe also said "C runs on many systems with noncontiguous memory segments but presents it as a single contiguous space." That is 100% false. In C, pointers to different objects are different. They're not even comparable. There is no concept of contiguous memory beyond that of a single array. Two arrays are not contiguous.
- 14y ago
- SeanDav 14y ago> C as a very thin virtual machine is a common conception and not an incorrect one I have worked extensively in the past with C and have never heard it referred to as a virtual machine, thin or otherwise. I understand that the OP probably means "computation model" or something similar but felt that the use of the phrase "virtual machine" was a bit on the bombastic side and that in addition to the general tone of the post made me think the post was borderline trolling. BTW. I would be quite happy to be proved wrong about C commonly being referred to as a thin virtual machine - what books/literature refer to C in this way?
- jerf 14y ago"I have worked extensively in the past with C and have never heard it referred to as a virtual machine, thin or otherwise." True. Usually other terms are used; for instance, "memory model". If you google that you'll find some things. As you read them, notice that they may or may not match the hardware you are actually running on, and given the simplicity of C's model, nowadays almost never does. C is a low-level language that lets you close to the machine, and even lets you drop into assembler, but it is true that it is enforcing/providing a certain set of constraints on how the library and code will act that do not necessarily match the underlying machine. It may not be a "virtual machine", depending on exactly how you define that term, but the idea isn't that far off. Also, this is a good thing, not a criticism. If it really was just a "high level assembler" that provided no guarantees about the system, it would be as portable as assembler, which is to say, not at all. For a much more clear example of this sort of thing in a language similarly thought to be "close to the metal", look at C++'s much more thorough specification of its memory and concurrency model, and again notice that this model is expected to be provided everywhere you can use a C++ compiler, regardless of the underlying hardware or OS. It is, in its own way, a virtual machine specification.
- jfb 14y agoIf you don't understand what "virtual machine" means in this context, why are you posting?
- popee 14y agoMaybe because he uses C and have never heard someone refering to VM and C in same sentence. I'm also interested in this because i also don't get wtf is "C VM". He could be refering to layer below which includes hardware and OS combo. You know, memory pages, translations, ... Is he talking about that? :-)
- pjmlp 14y agoYes. All languages have a virtual machine, or if you prefer abstract machine, that describes how the language sees the hardware. CINT is a C/C++ interpreter for example, http://root.cern.ch/drupal/content/cint http://root.cern.ch/drupal/content/cint Programming languages are independent of their canonical implementation. Usually the usage of a compiler, interpreter or JIT as default implementation is a matter of return of investment for the set of tasks the language is targeted for.
- oscargrouch 14y agoHe´s using the term VM, as a machine abstraction, wich C really is, in the same perspective the OS is a VM.. it will abstract you away, from device drivers, processor assembly, memory, (using files to represent a collection of data blocks in a block device) C is a VM. but not the same way the Java VM is a vm.. cause that is a VM on top of another VM (OS and processor assembly) its a software abstraction of a hardware system? its a VM.
- popee 14y agoSoftware abstracion of a hw system sounds ok. VM in C context is little bit weird ... but it's only terminology
- gsg 14y agoSeems to me that the GP was referring to the C abstract machine but used a similar, more common phrase by mistake. Granting that, I can't say I agree with his point: C has probably ran on more machines than any other language. As an abstraction over machines it is, if not perfect, clearly good enough.
- MichaelSalib 14y agoAlso using terms like "virtual machine" with respect to C is plainly ridiculous and a case of bullshit baffles brains. Note that the C language standards are written in terms of an "abstract machine". For example, "When the processing of the abstract machine is interrupted by receipt of a signal, only the values of objects as of the previous sequence point may be relied on" from 5.1.2.3.
- rayiner 14y agoThe term "virtual machine" has several meanings, only one of which is what you're thinking of (something like the JVM or CLR). In the context Madhadron's using it, "virtual machine" means the abstraction of the hardware that the C compiler presents to the running program. E.g. it presents an illusion of sequential execution even on machines such as Itanium that are explicitly parallel at the hardware level. It presents the illusion of memory being a uniform array of bytes, when on a modern machine it's actually composed of several disjoint pieces. CPU's and operating systems go to substantial lengths to present programs with a "C machine" on modern hardware. Your multi-core CPU doesn't look like a PDP-11, but it uses reorder buffers to make execution look sequential and cache coherence built on message passing to make memory look uniform.