4 ms·
I think the world of programmers have spent a bit too much time trying to avoid pointers, inventing a whole bunch of different languages, mechanisms and with th
by ixaxaar 3y ago
I think the world of programmers have spent a bit too much time trying to avoid pointers, inventing a whole bunch of different languages, mechanisms and with them a horde of other problems and useless complexities. Instead of this utter wastage, why not just use C?
- MrVandemar 3y agoBecause 'C', as fantastic as the language is, is prone to users making errors, and errors cost (sometimes incredible amounts of) money, and even peoples lives. See the Great 1990 Telephone Crash for the former. I like 'C', but I'd never get in an aircraft where a 'C' compiler was used for anything other than the in-flight entertainment system.
- LispSporks22 3y ago> I'd never get in an aircraft where a 'C' compiler was used So I take it you've never been in an airliner?
- defrost 3y agoThere's a lot of C code in avionics op systems, both new and old. There are multiple static analysis frameworks for verifying C code in aviation; Frama-C and Astrée just to name two. https://frama-c.com/html/overview.html https://frama-c.com/html/overview.html https://www.astree.ens.fr/ https://www.astree.ens.fr/ If you've ever got in an aircraft it's too late, you've almost certainly been in one using C for flight control functions.
- ixaxaar 3y agoI've worked in automotive where literally everything except the infotainment systems are in C. Almost all, if not all, firmware is in C. Also, not to mention every operating system. I really don't know where the "bugs are horrible" argument grounds itself on. I've worked on large C, rust, go, python and even Haskell codebases. Everyone of them had their share of super corner case bugs. The systems which use the simplest concepts and tools tend to have the least bugs cause they are more readable and hence fixable.
- ogogmad 3y agoOK but surely there's stuff that you wouldn't do in C. Maybe stuff that would require too much C code. Its features are pretty limited.
- uecker 3y agoThis is not my experience. I switched from C++ to C for all my programming. C certainly does not bring much out of the box, but with some data structures libraries ts a very good language for almost all purposes. A lot of bad press which is not really justified IMHO. There is certainly a lot of old bad C code around, but modern C written using modern tools can be quite good. For example, there is no need to do buffer management or string manipulation using open-coded pointer arithmetic, one can wrap this in safe APIs and then it is as safe as in any other language.
- pjmlp 3y agoWith high integrity code quality certifications like MISRA-C, a quality level that most folks with cry if forced to work daily under such restrictions. And since most companies keep failing at achieving the quality that random C coders say it is so easy on the Internets, provided one is a good C coder with discipline, now we have cybersecurity bills that in the long run will make any application making use of C or derived languages, be under similar control as MISRA and friends. Alterantively, one can use a safer language and not be so strictly regulated, as per those cybersecurity guidelines.
- UncleMeat 3y agoAnd every single verification framework for C code is way more challenging to work with than systems for a more modern language because in C as soon as you smell an aliasing relationship you are largely fucked for soundness.
- otabdeveloper4 3y ago> but I'd never get in an aircraft where a 'C' compiler was used for anything Enjoy walking, I guess.
- devwastaken 3y agoMajority of CVE's are memory corruption. It is not possible to move into the future without resolving this problem. If we don't fix it now you will be regulated to inferior solutions in the future. Software will be tied up in red tape just like building bridges. It will be interesting to watch insurance and liability protection require devs to act professional and choose proper tools, not excuse poor engineering with "just use old things I know."
- uecker 3y agoThere are plenty of other bugs causing CVEs, but there are certainly a lot caused by memory issues. I personally believe that C needs a safe mode, but also with existing tools (static analysis, sanitizers, etc.) one can improve things a lot. It is a bit unfair to compare billions of lines of old C code to newly written code in other languages. It would be interesting to compare modern C with modern tools to other languages. And, of course, all those billions of lines of old C code will continue to exist even if some people start to use other languages. So I think we need to improve C instead of abandoning it.
- devwastaken 3y agoThere isn't "modern C". You have to completely change the language to approach modern understanding of memory safety. C is the way it is because it was ignorant of what we know now. Progression of knowledge is why we deprecate and remove older tools.
- uecker 3y agoThis is Rust marketing but not reality. There are tools that ensure memory safety in C. Just - unfortunately - not open-source tools.
- cmrx64 3y agoThat’s kind of ridiculous, Rust deeply embraces pointers and that’s why people struggle with it. Rust is way better at pointers than C.