4 ms·
> Their popularity isn't due to having the best design, but rather to having a good enough design and being entrenched. They're old platforms, we've learned a l
by cwyers 10y ago
> Their popularity isn't due to having the best design, but rather to having a good enough design and being entrenched. They're old platforms, we've learned a lot since they were started.
I think one could say the same thing about C's popularity as a language.
- Sir_Cmpwn 10y agoI disagree. I think C is extremely well designed, but there are unfixable shortcomings to this design. Choosing it is a tradeoff.
- cwyers 10y agoYou don't think we've learned a lot about how to design programming languages since C was developed?
- Sir_Cmpwn 10y agoI think we've regressed in many ways, to be honest.
- cwyers 10y agoI find it rather implausible that we've managed to learn a lot of new things about operating system design and nothing about language design when the last major new operating system design to see significant adoption was probably NT in 1993, and we've had boatloads of new languages see adoption since then. Because the talent and effort is going to go where the rewards are, and if designing new languages is more productive than developing new operating systems, I would think that's where most of the energy is going. The inverse of Sturgeon's Law is that 20% of everything isn't crap, and the more of something you have, the larger that 20% is.
- Sir_Cmpwn 10y agoThe main difference is that operating systems are complicated and programming languages (are supposed to be) simple. The biggest strength of C is its simplicity - there's not much that can go wrong with such a small feature set. I find Go to be pretty strong for similar reasons.
- cwyers 10y agoThe long lists other users have posted in this thread of bugs in curl that wouldn't have been possible in another language suggests that in fact there's a lot that can go wrong with C.
- pcwalton 10y agoC is not simple. It is incredibly complex, due to the way the standard specifies all operations in terms of an abstract VM and offers absolutely no guidance on what to do when code goes out of a small set of behaviors. Because undefined behavior is so easy to trigger, essentially all large production C code relies on undefined behavior.
- Sir_Cmpwn 10y agoI guess it's simpler in principle than in practice. I still think from a usability and day-to-day standpoint C is very simple once you grok it.
- pcwalton 10y agoIt depends on whether you actually want to know precisely what your code does. For me, that's essential to writing reliable software. In my view, one of the reasons why we consistently fail to produce reliable software is that we continue to use a language from the 1970s that makes it very hard to determine what the meaning of a program is.
- greenhouse_gas 10y ago"Classic" C was actually simpler and safer than modern C. Before optimizers, C was a WYSIWYG language. Yes, you can shoot your foot (gets) but you know what's happening where, and can manually check everything. Modern C with language lawyering can "optimize out" your safety checks, leading to exploits.
- smitherfield 10y agoC was well-designed for its time, but "extremely" well-designed is a stretch given the much better designs that came immediately before (ALGOL 60 and 68, Pascal, Scheme) or after (Ada, Modula, ML) it. C was optimized to be fast to implement (and won out for that reason — "worse is better," and because UNIX was the first usable OS written in a high-level language), not for the best practices in safety or even performance, even as understood at the time.
- Sir_Cmpwn 10y agoI'm not talking about pre-ANSI C. Compare C89 to those languages and, in my opinion, C comes out on top.
- smitherfield 10y agoI'd really disagree. All those languages are both safer and more expressive (if more verbose in the case of those with Pascal-like syntax) than any version of C, and, except in the case of ML, Scheme and ALGOL 68 with the optional garbage collection, there's no reason they couldn't be as fast or faster than C. Their main fault was simply in being too ahead of their time: too difficult or impossible to implement well on a PDP-11. (I deleted the part about FORTRAN 77; seems I was confusing it with F90, which is the version that first allowed identifiers longer than 6 characters, dynamic memory allocation and user-defined types).