Hacker News new | ask | show | jobs
by cheatercheater 5221 days ago
> But the more I think about it, the more I like C. It gives you the best understanding of what computations are actually being done by your processor

Yes, because C is exactly how computers work inside! SO CLOSE TO THE METAL

> the mental exercises involved with fulling understanding pointers is valuable at the collegiate level

I have learnt about mappings in mathematics in kindergarten. Literally. Then in university we have had exactly one sentence to flesh out the idea in ZFC. You really think C is so mind bending?

4 comments

And at the same time we have a whole generation of people that don't know what a tail call is. C might be closer to the metal then most languages but it still is a leaky abstraction in some places.

And anyway, the real problem is not C being complicated. Its that the other alternatives are also perfectly reasonable while also being simpler.

I believe it is quite close to the metal. When I had my Systems Programming course in first year of college we started with C, and then continued with x86 assembly. One of interesting parts was, when we compiled our C code to assembly and then compared with our hand-written assembly code. Was fun :)
Do you realize that with pipelining, preemptive computation, multiple levels of caching, opcode optimization, NUMA, massive parallelism, and all that other stuff x86 is to hardware what Java is to hardware interrupts?

Answer: you don't because otherwise you would not have posted the above.

You're over exaggerating. You can teach students about processor theory, assembly language and C without getting into all the extra stuff.

All the extra stuff is built on that foundation, and learning C helps you understand that foundation better than any other language.

This is not "extra stuff". It is how it works. x86 was made to be simple to hand-code, not to in any way reflect the hardware. And then, decades later, new developments to it are so that it's easy to compile to. The language went through two major paradigms without either having the point of x86 reflecting the hardware it abstracts. SIMD, NUMA, pipelining and caching is exactly how processors work right now. And they're radically different to what happened before the Intel Core family of processors. This is in turn radically different to what happened before the Pentium Pro family of processors. Yet all support the same x86 instruction set. The corollary is that x86 is an abstraction. You're being ignorant if you think x86 is like the opcodes being executed after the whole caching stage has happened.
I never said it was mind bending. I said it was a good mental exercise for young engineers to go through to fully understand pointers.

It's one thing to read about pointers, it's another to actually implement a linked list in C.

Again, I want to stress I don't think you should get awarded a PhD for it, but for first year CS majors: it is good practice to actually implement and debug pointer-based data structures.

Yeah, but you're obviously arguing about that it's notable that you can learn about pointers. It's a tiny block of knowledge, really minuscule in comparison to other things which you can learn in the first year, such as the notion of an isomorphism, with assorted examples. I'd say this one can easily fill up about 100x more lab time.
C is not CLOSE TO THE METAL. It lacks concept of SIMD instructions and barriers/fences. If you want to be CTM learn OpenCL / CUDA (unless you want to learn assembler for actual ISAs or SIMD extensions).
Thanks for spelling it out, I am surprised there are people in this year and age who would not get that "C is close to the metal" is a trite joke.