5 ms·
For new Language to become safe you need to write state of-the-art linters, static source code analyzers, dynamic code analyzers, code coverage analysis tools,
by Nokinside 10y ago
For new Language to become safe you need to write state of-the-art linters, static source code analyzers, dynamic code analyzers, code coverage analysis tools, testing tools for the language.
C has all these. Only C/C++ and Ada have these.
People who say "C is not a safe language" may not be aware, but most of the worlds safety critical code is written in C or ancient C++. Most aerospace, military and medical applications are written either in C/C++ or Ada. Ada would be much safer than C, but it has been abandoned for C/C++ because language of choice is not that important.
If the culture and tooling to write safe code is not there, changing language is not going to help. It's currently easier to write safe code in C than it's to write safe code in your favorite 'memory safe' language like Rust.
https://en.wikipedia.org/wiki/MISRA_C https://en.wikipedia.org/wiki/MISRA_C
- danieltillett 10y agoThis is so true. It seems like most of the arguments against C are made in isolation of the ecosystem that has been built around C. At this point we should be helping new programmer learn how to work with C with all the safely equipment we now have.
- pjmlp 10y agoBecause only around 1% of all C developers care to use such band aids.
- Nokinside 10y agoThey are not band aids. Analysis tools for C exceed anything you can have in Rust or Go compiler in scope and features.
- danieltillett 10y agoExactly. The real problem is many C developers are unaware of these tools. Rather than just saying use programming language x, we should be helping people use C with the right tools.
- pjmlp 10y agoNot at all. These tools exist since 1979, it hasn't changed anything. C doesn't deserve a place on any security conscious developer toolbox.
- pjmlp 10y agoSomething that is optional doesn't exceed what are standard safety features in programming languages since Algol and its derived languages exist. Having external tools to track out of bonds errors, use after free, double free, free bad pointers, implicit conversions and UB, errors that don't happen in another languages is band aid. Other languages just don't need them thanks to being designed with safety first.
- danieltillett 10y agoI write in C (mostly) and very few of my bugs are the typical errors C is famous for - 99.9% are logic bugs that can occur in any language. I have lots of great tools to catch the C type bugs - I wish I had a tool to catch my logic bugs. Tests can only find the bugs where the code doesn't do what I expect, not where what I expect is wrong.
- pjmlp 10y agoWhich tells me that you work alone without other devs of various skillsets messing around your beautiful C code.
- danieltillett 10y agoWell I wouldn't call my C code beautiful, but no I don't work alone. I do only work with devs better than me :)
- Nokinside 10y ago>Other languages just don't need them thanks to being d esigned with safety first. Other languages are not used for writing safety critical code. Language features are not even close being enough for that.
- pjmlp 10y agoAda and SPARK are such languages, better improve your knowledge.