Ben Cantrick (mackys) wrote,
Ben Cantrick
mackys

  • Mood:
  • Music:

Quit damning C with your faint praise.


Here’s the thing: C is everywhere. Recently Tim Bray made basically the same point; all the major operating systems, all the high-level language runtimes, all the databases, and all major productivity applications are written in C. And there are many other categories of software that I haven’t even mentioned, all written in C.

So can you as a developer choose to ignore it? Live in high-level language land for your entire career? I would say almost certainly not. High-level languages often provide abstractions that relieve you from the burden of dealing with the platform on which you’re building. Which is great, but sooner or later a crack is going to open up and the abstraction is going to leak.

Some day you’ll need to go spelunking into the depths of your runtime environment. Maybe you’ll need to call some other C-based API for which you don’t have a convenient wrapper in your high-level language of choice. Like, say, mmap-ing a part of a file instead of the whole thing. Or maybe you’ll just want a bit of a performance boost. And on that day, boy will you wish you knew C.

It’s for this pragmatic and entirely non-bigoted reason that I promoted C to the top of my language pantheon. If you’ve never learned C, it means you’ll never be able to delve too deeply into the foundations your programming environment and find out exactly what is happening under the surface, or to extend it in any way.


http://girtby.net/archives/2008/8/23/in-defence-of-c

Do these arguments ("it underlies everything", "you need it for maximum performance", "it's the only way to do certain things") sound familiar at all?

How about if you s/C/assembler/g and read again?

C will go the way of assembly sooner or later. All the same arguments are being made in its defense. The only question is, how long will it take? Don't get me wrong - I like C, and I hope it will be a long, long time before it goes away. But don't kid yourself. Nobody learns assembly any more (except for embedded engineers and a few EEs), and there will come a day when C suffers the same fate.

And frankly, I find all this over-blown defense of C to be stupid. Quit damning C with faint praise. It is a perfectly good programming language on its own merits. So good, in fact, that it's spawned a horde of imitators and knock-offs. C++, Java, C#, etc, etc - they're all based on C syntax. Partly a historical accident? Sure. But ask yourself this: if it's only about history, why didn't FORTRAN or COBOL come to dominate? You pretty much have to concede that C is awfully good for a language invented 35 years ago.

If you really want to defend C, how about less of this "well, you have to know it, because everyone else knows it!" argument-from-popularity bullshit1, and a little more of the "C is a good language because..." A) it's relatively simple and clean, B) anything you want to do, someone HAS done it before in C, and you can probably download the code, and C) yeah, okay, when performance does matter2, C is a reasonable choice.


N.B. Pre-emptive stike against the C++ weenies: NONE of the above arguments are meant, in any way, to defend or endorse C++. I am talking about, at most, C99 here.

-----
1 Save that for your vi vs emacs holy wars. Lamer.
2 Which it very often does not - see Programming As If Performance Matters.
Tags: reddit
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 3 comments