Live data from Hacker News

Should you learn C to “learn how the computer works”?

words.steveklabnik.com

51–60 of 381 posts

Re: Should you learn C to “learn how the computer works”?

#51

I find this article to be disingenuous. Yes, C isnt "how a computer really works". Neither is assembly. The way a computer works is based off of transistors and some concepts built on top of that (ALUs for example). However, there is no need to know about any of that because you're presented with an abstraction (assembly). And thats really what people mean when they say C is closer to how a computer actually works: i…

> The way a computer works is based off of transistors and some concepts built on top of that (ALUs for example). However, there is no need to know about any of that because you're presented with an abstraction (assembly).

I'd argue you should know how that works.

Cache-misses, pipelining and all these subtle performance intricacies that seem to have no rhyme or reason just fall out out understanding exactly how you get shorter clock cycles, different types of memory and the tradeoffs that they present.

One of the best things I ever did was go build a couple projects on an FPGA, when you get down to that level all of these leaky (performance) abstractions are clear as day.

Re: Should you learn C to “learn how the computer works”?

#52

I find this article to be disingenuous. Yes, C isnt "how a computer really works". Neither is assembly. The way a computer works is based off of transistors and some concepts built on top of that (ALUs for example). However, there is no need to know about any of that because you're presented with an abstraction (assembly). And thats really what people mean when they say C is closer to how a computer actually works: i…

I would go further and say that how modern computers work at the level that interests most people is somewhat based on C. It would be very different with another hardware abstraction paradigm such as Lisp Machines (as their name suggests), but that's not what we have :).

EDIT: I was going to update my comment a bit now that I thought more about it and that I'm on a computer rather than a mobile phone, but in the meantime jerf posted a very good reply to the parent comment so just read that ^^.

Re: Should you learn C to “learn how the computer works”?

#53
I stopped reading when I got to "C also operates inside of a virtual machine."

Is the author confusing virtual memory with virtual machine? Perhaps they're referring to the way a high level language abstracts away the details of the H/W. I didn't care enough to read on.

That said, I learned the most about "how a computer works" in a class that taught Intel 8080 assembler on a system running CP/M. (Technically it was MP/M but there was only a single console.) The instructor spent a lot of time explaining what registers were, accumulators, stack pointer, addressing RAM and so on. That's why I learned about H/W details, not because I focused on a particular language.

I thought the entire reason for C was to avoid having to deal directly with the H/W (though it can be done.)

Re: Should you learn C to “learn how the computer works”?

#54
post #53

I stopped reading when I got to "C also operates inside of a virtual machine." Is the author confusing virtual memory with virtual machine? Perhaps they're referring to the way a high level language abstracts away the details of the H/W. I didn't care enough to read on. That said, I learned the most about "how a computer works" in a class that taught Intel 8080 assembler on a system running CP/M. (Technically it was…

I'm confused as well. Klabnik is no doubt reading this thread. I'd like to know more about the "virtual machine" he supposes the C language targets.

Re: Should you learn C to “learn how the computer works”?

#55
No, you should learn one or more assembly languages and read some arch reference manuals and their supporting glue chip reference manuals if you want to learn "how the computer works" from the perspective of programming after reading an academic book or two on the subject of computer architecture.

C is useful for participating in commercial application of these things, but it is possible to be a very accomplished C developer and have no idea how hardware interfacing works and I'd wager this category vastly outnumbers those that understand hardware interfacing.

Re: Should you learn C to “learn how the computer works”?

#56
post #53

I stopped reading when I got to "C also operates inside of a virtual machine." Is the author confusing virtual memory with virtual machine? Perhaps they're referring to the way a high level language abstracts away the details of the H/W. I didn't care enough to read on. That said, I learned the most about "how a computer works" in a class that taught Intel 8080 assembler on a system running CP/M. (Technically it was…

C does indeed present the programmer with an abstract machine (which may be vastly different from the actual hardware).

Re: Should you learn C to “learn how the computer works”?

#57

Is this not a strawman? I've never seen anyone, ever, say that C is "how the computer works". Searching for references (since the author provides pseudo-quotes to refute that they seem to have invented) finds shockingly few making such a claim.

I know its anecdotal, but I hear the phrase all of the time. People who have only ever used higher-level languages, and want to learn more about computers. The say that they would rather learn C over C++, Rust, etc. because C is 'how computers work'.

Re: Should you learn C to “learn how the computer works”?

#58

C doesn't necessarily teach you how computers work. But it does teach you how software works. Our modern software empire is built on mountains of C, and deference to C is pervasive throughout higher-level software design. >You may have heard another slogan when talking about C: “C is portable assembler.” If you think about this slogan for a minute, you’ll also find that if it’s true, C cannot be how the computer work…

C at the very least teaches the difference between stack and heap memory, a crucial concept obscured by most higher-level languages.

Re: Should you learn C to “learn how the computer works”?

#59
post #56
post #53

I stopped reading when I got to "C also operates inside of a virtual machine." Is the author confusing virtual memory with virtual machine? Perhaps they're referring to the way a high level language abstracts away the details of the H/W. I didn't care enough to read on. That said, I learned the most about "how a computer works" in a class that taught Intel 8080 assembler on a system running CP/M. (Technically it was…

C does indeed present the programmer with an abstract machine (which may be vastly different from the actual hardware).

It's clear this was the author's intention here. He is using the term "virtual machine" broadly. Whether this makes for as effective or interesting a "twist" as he hopes it does is another matter.

Re: Should you learn C to “learn how the computer works”?

#60
post #53

I stopped reading when I got to "C also operates inside of a virtual machine." Is the author confusing virtual memory with virtual machine? Perhaps they're referring to the way a high level language abstracts away the details of the H/W. I didn't care enough to read on. That said, I learned the most about "how a computer works" in a class that taught Intel 8080 assembler on a system running CP/M. (Technically it was…

[deleted]
Post reply on HN