Hacker News new | ask | show | jobs
by nickpsecurity 3777 days ago
There's a number of HLL's to choose from today with less safety issues. Start with an efficient one. If developing languages or compilers, then put effort into one that has a nice foundation instead of C. Similarly, there's prior work on C-like languages that had enhanced safety (Cyclone, Ivory) and tools like Softbound+CETS that automatically make code safe w/ a penalty. Use or invest effort in such tools. And finally, if nothing else is available, use a subset of C with sensible coding style and throw every bug-finding tool you can at it.

Those are the recommendations in that order. What you use depends on your domain, constraints, skills, and so on. Modula-2, Active Oberon, Modula-3, Free Pascal, and Component Pascal were probably closest to C's domain in terms of safe, efficient, easy-to-compile languages. Ada is systematic in all the errors it handles but with steep, learning curve. SPARK straight up proves your code. One can also use DSL's/4GL's that generate proper C w/ automated checks like iMatix and Galois do (and I once did). I've also seen Ocaml and LISP used for real-time, even embedded, systems with custom runtime. Ocaml was also used for tooling w/ source to object code verification.

So, there's a number of options. Each are behind C currently in tooling due to limited uptake and investment. More uptake and investment can fix that. Even so, average results of those tools have far lower defects than C code with shorter time to train people (ignoring Ada). That most teams aren't composed of geniuses in safe coding means that's important too.

1 comments

Add to the list ATS, combining features suited for low-level programming (and C-level performance) and dependent types to make it safe.
ATS is interesting. I've seen it used in device drivers and one 8-bit system IIRC. The reason I left it off is that I'm not sure most people can learn how to use it. Whereas, we've taught ALGOL languages, Scheme, and Ocaml to all kinds of people where they're effective enough with types & assertions.

These more mathematical languages have to prove themselves out with real-world examples, algorithms and compiled code, before I recommend them. I'd like to see CompSci keep hammering away at them to find easier and easier ways of learning and using them. Not to mention improve tooling.