Should you learn C to “learn how the computer works”?
41–50 of 381 posts
Re: Should you learn C to “learn how the computer works”?
#42You'll learn what code looks like to the CPU, you'll get a feeling for how OOP works inside that box (things like the "this" pointer, vtables), what structures look like in memory, how dynamic linking works vs static linking by actually looking at what that code looks like in an executable. And you'll have something to show for it - something to prove you've acquired enough knowledge to achieve goals.
Re: Should you learn C to “learn how the computer works”?
#43Do you need to learn C to have a successful career in CS or any other field? No. Should you learn it? Yes. Do you need to bake bread to eat it? No. Should you learn to bake it? Yes. There are lots of things you should learn to do because they're useful and teach you about how the world works. The miracle of society is that you don't have to learn most of them to enjoy using them.
That bread analogy is on point. The old quote comes to mind, >A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyse a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die g…
Re: Should you learn C to “learn how the computer works”?
#44Earlier quoted context omitted.
That assumes that all strings are C strings which isn't true. For example, Pascal-style strings have a size before the string data, and Rust and C++ strings have the size as metadata on stack and the string data in heap.
This thread apparently started out as a misunderstanding, but just to show how free this can be: https://godbolt.org/z/7ehDPx
Re: Should you learn C to “learn how the computer works”?
#45Earlier quoted context omitted.
IIRC there was some UB feature that when compiled with GCC would launch nethack.
Found it: >When GCC identified “bad” C++ code, it tried to start NetHack, Rogue, or Towers of Hanoi. Failing all three, it would just print out a nice, cryptic error message. https://feross.org/gcc-ownage/
Re: Should you learn C to “learn how the computer works”?
#46Coming from an operating system background, I find the article's use of "virtual machine" very bizarre. The article confuses very different things by stating that "'runtime', 'virtual machine' and 'abstract machine' are different words for the same fundamental thing".
Re: Should you learn C to “learn how the computer works”?
#47Concepts of structured programming arise from noting patterns commonly used -- you start using GOSUB instead of GOTO; you tend to make your loops very strictly nested because otherwise the code becomes unmaintainable, you find yourself writing data structures to manage related records, etc. From there, the transition to structured programming becomes very natural -- just formalizing some concepts that you've already internalized.
Re: Should you learn C to “learn how the computer works”?
#48Re: Should you learn C to “learn how the computer works”?
#49Coming from an operating system background, I find the article's use of "virtual machine" very bizarre. The article confuses very different things by stating that "'runtime', 'virtual machine' and 'abstract machine' are different words for the same fundamental thing".
How do you feel about the "Java Virtual Machine" then?
In typical use of a C compiler, you get code for the target processor, i.e. x86. In theory, you don't have to worry about the underlying hardware, so you could say you are programming for some abstract machine that runs C code, but it is much less meaningful than saying java has a virtual machine.
Re: Should you learn C to “learn how the computer works”?
#50One of my favorite classes in college was Computer Architecture 1 and 2, which encompassed logic gates, Boolean logic, and progressed to assembly language usage. C was covered in other classes and was a natural next step from Architecture. I credit those classes a ton for my lower level knowledge.
It was probably the hardest course of my entire degree, and I ended up taking it twice, but at the end of the second go-round, computers were no longer a magic black box.