5 ms·
> 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
by 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 agoHe probably meant to type C/C++ or something but typo'd it. The set of vulnerabilities is exactly the same. If Pascal still lets you do heap corruption, it's only a matter of time before RCEs become common. So yeah, I'm convinced on that point.
- nickpsecurity 8y agoSchemes for memory safety of C code have already been applied to UNIXy OS's. SVA-OS with SAFEcode used FreeBSD. Far as embedded, there were some done in Ada and a Java subset. There's even real-time GC's for that kind of stuff. One or two companies sell Java processors that run it natively. CompSci stays doing CPU extensions that could work with MCU's.
- pjmlp 8y agoThere is this expression, a language is a dialect with an army. The same applies to system languages, just that the army is the OS that bundles them as THE official language. Pascal based OSes unfortunately lost their place on the market. To pick a more modern example, how many people would have bothered with JavaScript if it wasn't THE language on the Web OS?