3 ms·
I disagree. The C programming language is directly responsible for countless damning flaws in modern software and can be credited for the existence of the major
by verisimilitudes 7y ago
I disagree. The C programming language is directly responsible for countless damning flaws in modern software and can be credited for the existence of the majority of the modern computer security industry.
You can write system software in many languages, including Lisp. For a less outlandish example, Ada is specifically designed for producing reliable systems worked on by teams of people in a way that reduces errors at program run time.
I find it amusing to mention UNIX fundamentals as a reason to learn C, considering UNIX is the only reason C has persisted for so long anyway. Real operating systems focused largely on interoperation between languages, not funnelling everything through a single one; Lisp machines focused on compilation to a single language, but that language was well-designed and well-equipped, unlike C.
>Last but not least, because C is so “low-level”, you can leverage it to write highly performant code to squeeze out CPU when performance is critical in some scenarios.
It’s actually the opposite. The C language is too high-level to correspond to any single machine, yet too low-level for compilers to optimize for the specific machine without gargantuan mechanisms. It’s easier to optimize logical count and bit manipulations in Common Lisp than in C, because Common Lisp actually provides mechanisms for these things; meanwhile, C has no equivalent to logical count and its bit shifting is a poor replacement for field manipulations. Ada permits specifying the bit structures of data types at a very high level, while continuing to use abstract parts, whereas large C projects float in a bog of text-replacement macros.
Those are my thoughts on why C isn’t worth learning, although this is nothing against the author.
- ajxs 7y agoAbsolutely agree. After I began learning Ada, I could never look at C the same way again. It's an incredibly fluid and intuitive language that shines in the areas that C has dominated, without any of the pitfalls that make serious development in C so difficult. It's very easy to see why it remains the language of choice for life-critical applications.
- pjmlp 7y agoNow imagine those of us that already knew Turbo Basic, Turbo Pascal, Modula-2, before seeing C for the first time. Naturally we weren't tainted by the myth that C was the very first systems language and we knew there was a better way. Morry Worm is 30 years old by the way.
- jstewartmobile 7y agoMy mother bought the family a PC back in the early 90s. She was working on a masters degree, and her coursework required it. I taught myself Turbo Pascal on that machine. Loved it! Years later I started college (originally majoring in CS), and they taught their courses in C++. I read the manual cover-to-cover and finished out the course, just to give it a fair shot. Wasted time though. To know it is to loathe it. At the end of the course, changed my major to computer engineering and never looked back. Wirth languages are where it's at!
- kazinator 7y agoTurilli's Modula-3 was a good job, I think. The distributed version of CVS (the version control system) called DCVS is written in Modula-3.
- kazinator 7y agoI had lots of experience in Modula-2 and Pascal (including Turbo Pascal) before C. I liked C very much. The very syntax was a breath of fresh air; just } to close scopes and so on. The declarations that resembled uses of the identifier looked good to me. Good old Don Knuth had a similar reaction (also coming from lots of experience in Pascal, Algol and their ilk). In a 1993 interview he said this: I think C has a lot of features that are very important. The way C handles pointers, for example, was a brilliant innovation; it solved a lot of problems that we had before in data structuring and made the programs look good afterwards. C isn't the perfect language, no language is, but I think it has a lot of virtues, and you can avoid the parts you don't like. I do like C as a language, especially because it blends in with the operating system (if you're using UNIX, for example). I don't entirely agree with him but sympathize with the reaction. (No you can't avoid the bits you don't like, unless you're a lone hacker who doesn't have to integrate any third party-code, which pretty much describes Knuth.)
- pjmlp 7y agoTo each its own I guess. For me, C versus Turbo Pascal 6.0 just felt backwards, thankfully the professor that was giving us C classes, also made a C++ compiler available on the school lab. So given the choice of C vs C++, when coming from Wirth's school of type safety, the option was obvious.
- adrianN 7y agoC might not be particularly designed for high performance computing, but there has been an absolutely enormous amount of work on compilers for C. Due to its prevalence, even CPU manufacturers take care to design their chips so that C code runs fast on them. Effectively this makes C one of the fastest languages around. The story is similar for Javascript. The language design is fairly terrible, but thanks to millions of dollars invested into Javascript JITs, it's now one of the fastest interpreted languages.
- pjmlp 7y agoOnly to catch up with what was already happening outside Bell Labs world. C is indeed the JavaScript of systems programming. "Oh, it was quite a while ago. I kind of stopped when C came out. That was a big blow. We were making so much good progress on optimizations and transformations. We were getting rid of just one nice problem after another. When C came out, at one of the SIGPLAN compiler conferences, there was a debate between Steve Johnson from Bell Labs, who was supporting C, and one of our people, Bill Harrison, who was working on a project that I had at that time supporting automatic optimization...The nubbin of the debate was Steve's defense of not having to build optimizers anymore because the programmer would take care of it. That it was really a programmer's issue.... Seibel: Do you think C is a reasonable language if they had restricted its use to operating-system kernels? Allen: Oh, yeah. That would have been fine. And, in fact, you need to have something like that, something where experts can really fine-tune without big bottlenecks because those are key problems to solve. By 1960, we had a long list of amazing languages: Lisp, APL, Fortran, COBOL, Algol 60. These are higher-level than C. We have seriously regressed, since C developed. C has destroyed our ability to advance the state of the art in automatic optimization, automatic parallelization, automatic mapping of a high-level language to the machine. This is one of the reasons compilers are ... basically not taught much anymore in the colleges and universities." -- Fran Allen interview, Excerpted from: Peter Seibel. Coders at Work: Reflections on the Craft of Programming
- ChuckMcM 7y agoIsn't that a bit like saying assembly language is directly responsible for all of the trojans and virii out in the world?
- verisimilitudes 7y agoI find it absurd that, in criticizing C, you conflate that with the underlying machine. But, in a way, sure. There's been plenty of hardware that had safety features and other high-level qualities, but C could never take advantage of them and now there are plenty of stupid RISC machines that resemble a PDP-11 well enough. So, without C, the common hardware would probably be better, too.
- johnr2 7y ago>I find it absurd that, in criticizing C, you conflate that with the underlying machine. It could be argued that assembly language doesn't always run on the underlying machine either, given the amount of microcode used in modern CPUs.