3 ms·
I 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.
by Sir_Cmpwn 10y ago
I 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.