4 ms·
There's no way to "fix C" in a way that saves you from the cost of fixing all those broken programs written in C. The best a language-level solution can do for
by andrewflnr 8y ago
There's no way to "fix C" in a way that saves you from the cost of fixing all those broken programs written in C. The best a language-level solution can do for an existing project is make it easier to figure out what specifically needs fixing. Or blow up your code and run time with checks, I guess, but if that was technically feasible, to say nothing of political challenges, those projects wouldn't have been in C to start.
I feel like Elrond at the council of Rivendell: "you have only one choice." Except throwing a ring into a hole is a comparatively well-defined task relative to rewriting an unknown number of crappy pieces of software. Ed: also there's no conveniently situated group of people to whom to assign the project.
- pjmlp 8y agoBasically, until the world gets rid of UNIX derived OSes, we call it a defeat and go back home.
- andrewflnr 8y agoIf you're trying to characterize what I said, no. I'm saying we need to work on convincing the world to frigging drop Unix-derived OSes already.
- pjmlp 8y agoAgreed, but it seems we are loosing on that front from the last 20 years, right? Including the commercial failure of Inferno. How things are going even Microsoft could eventually have again their own version. So from the business perspective it seems the only way to win is to fix the language UNIX is written on.
- pcwalton 8y ago> Or blow up your code and run time with checks, I guess, but if that was technically feasible, to say nothing of political challenges, those projects wouldn't have been in C to start. Most of the infrastructural projects you're referring to predated modern languages. There is no reason, for example, for an MTA to be written in C today. We use MTAs written in C because MTAs are old.
- andrewflnr 8y agoThey had pascal and friends, didn't they? Which are safer, safe-ish, right? But I guess today you could eat the cost of automatically inserted runtime checks on software designed to push the limits of 30yo hardware. Still won't fly for Linux or embedded systems...
- pcwalton 8y agoThe versions of Pascal that are practical aren't any safer than C. With a properly designed programming environment, you don't need many bounds checks to begin with. Almost every embedded system can easily afford the cost of the few you can't eliminate.
- pjmlp 8y agoOn the contrary. While they aren't Rust level safe, they eliminate like 80% of the common C safety errors. Thanks to explicit conversions, proper enums, reference parameters, actual string and vector types, memory allocation based on types instead of arbitrary numbers, type safe linkage thanks modules. So while use after free or double frees would are still an issue, many other classes of typical C errors would be gone.
- pcwalton 8y agoConversions and such aren't where the memory-safety-related vulnerabilities in C++ come from nowadays. They come from memory management problems, which Pascal doesn't help with.
- pjmlp 8y agoMoving goal posts here? I thought we were speaking about C. Yes Rust is great and all, sometimes getting people half-way is better than not at all.
- andrewflnr 8y ago