3 ms·
I 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
by cwyers 10y ago
I 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.
- pcwalton 10y agoYet those optimization passes have been essential for keeping C alive. Optimizing C well depends on exploiting undefined behavior. And if not for optimizing compilers, I think C would have been replaced a long time ago. For example, when everything can legally alias everything else (as in the case of "classic" C), it's hard for a compiler to prove anything about the contents of memory. This prevents a lot of seemingly-obvious optimizations. The problem with C is that you need to violate many programmers' assumptions about how the language operates in order to make it fast. It's not a coincidence that a lot of C/C++ compiler developers have ended up moving on to other languages.
- pjmlp 10y ago> It's not a coincidence that a lot of C/C++ compiler developers have ended up moving on to other languages. Some examples are Chris Lattner, Doug Gregor or Cliff Click. Or as Chris Lattner puts it, he writes C and C++ so that we don't have to.