3 ms·
You can tell the author will not address the matter seriously already from the title: First, talking about "Science" in general seems like grandstanding; and it
by einpoklum 5y ago
You can tell the author will not address the matter seriously already from the title: First, talking about "Science" in general seems like grandstanding; and it immediately becomes clear that the author is citing some industry surveys regarding people's perceptions of the cause of bugs. So it's not like "Science has spoken".
Second, C and C++ are very different languages.
Thirty years ago, you could have put them in the same basket; but times have changed. C++, with its standard library, has advanced to a point where issues such as use-after-free and double-free disappear - not through programmer discipline, but by the programmer simply not allocating and freeing memory themselves. See this post:
"Why doesn't C++ have a garbage collector?"
https://stackoverflow.com/a/48046118/1593077 https://stackoverflow.com/a/48046118/1593077
Moreover, when you're dealing with low-level and system software, especially OS kernels, it is usually either impossible or impractical to use a higher-level language, with a large interpreter or an even-larger virtual machine. And when the "safe languages" are used for such tasks, one often goes into unsafe mode, like Java's JNI.
Now, it's quite possible that using Rust in more lower-level settings will result in fewer memory bugs. But the author has overreached with a flamebait of post and a claim.
- pjmlp 5y agoIdeally yes, unfortunely too many people keep writing C+, not C++. Trying to prevent it seems to be a quixotic endevour other than migrating to something else (doesn't need to be Rust), unless C++ vendors finally adopt some kind of -fvintage-c++=off compiler flag.
- einpoklum 5y agoWell, the C++ coding guidelines project is focused in particular on static analysis measures, and there is quite a bit of collaboration from IDE developers (not sure about compiler authors). So, a "vintage C++ off" is actually less unrealistic than you might believe. In particular, I see IDEs and compilers easily shifting to making it annoying for people to make raw allocations for example. Still, point well taken about people tending to write "C+". They then also complain about how modern C++ is complicated and they can't "see what's going on" etc.
- pjmlp 5y agoWatch the latest Bjarne interview where he shows his disapointment for the C++ coding guidelines being largely ignored by the industry. https://www.youtube.com/watch?v=ae6nFZn3auQ https://www.youtube.com/watch?v=ae6nFZn3auQ Basically unless you are using Visual C++, there is little chance the C++ shop will have much C++ Core Guidelines love, and even on Visual C++, stuff like "borrow checker lite" are mostly broken beyond basic examples.
- MaxBarraclough 5y agoIs there at least a lint tool for checking compliance with the Core Guidelines?