Stop Hating on C!

It seems most computer science programs out there don't teach C programming anymore, instead focusing exclusively on higher-level languages such as Java or Scheme. I would say there's actually quite a bit of C hate going around. People would like to claim that C simply isn't a language worth learning, that C is badly designed, that it's overly complex and extremely error-prone, that it's unpredictable and brittle.

You can hate on C as much as you want, but the truth is that it's a programming language that's survived for 40 years, delivers unparalleled performance and powers the core of almost every computer system in existence. C isn't just used for low-level kernel and driver hacking either. Even today, almost all games programmed for the PlayStation 3 and other consoles are programmed in C and C++. Suck on that, haters!

C isn't badly designed, or overly complex. It has a very simple grammar, predictable semantics and accomplishes its design goals very well. The C language is meant to be a platform-neutral abstraction layer over assembly language. C allows you to make function calls and manipulate pointers or other machine data types in a consistent way across different platforms, without having to worry about how these operations are going to be implemented in terms of machine code.

Surely, the language could be improved in various ways (no header files, anyone?), but its beauty stems from the fact that it's a very thin abstraction layer over the hardware. As such, it's a very good representation of what actually happens behind the scenes and does not have hidden costs or performance penalties. Languages such as Java, Scheme and JavaScript most certainly have their place, but they are rather far removed from the internal workings of any CPU, and thus far, cannot compete with the performance attainable by C programs.

I believe this message, posted anonymously on 4chan, says it best:

I don't think C gets enough credit. Sure, C doesn't love you. C isn't about love--C is about thrills. C hangs around in the bad part of town. C knows all the gang signs. C has a motorcycle, and wears the leathers everywhere, and never wears a helmet, because that would mess up C's punked-out hair. C likes to give cops the finger and grin and speed away. Mention that you'd like something, and C will pretend to ignore you; the next day, C will bring you one, no questions asked, and toss it to you with a you-know-you-want-me smirk that makes your heart race. Where did C get it? "It fell off a truck," C says, putting away the boltcutters. You start to feel like C doesn't know the meaning of "private" or "protected": what C wants, C takes. This excites you. C knows how to get you anything but safety. C will give you anything but commitment

In the end, you'll leave C, not because you want something better, but because you can't handle the intensity. C says "I'm gonna live fast, die young, and leave a good-looking corpse," but you know that C can never die, not so long as C is still the fastest thing on the road.

As far as C and its derivatives being worth learning, it seems that might depend on your area of expertise. There are certainly millions of programs and libraries written in C out there, and this alone might justify wanting to learn C. The other reason is that once you truly master C, you will have an understanding of computers that goes far beyond that of most programmers out there. Once you understand pointers, memory allocation and integer arithmetic, you will have a basic, intuitive understanding of the beast that makes your computer tick, and no programming language will ever scare you again.