General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Mikko Rantalainen
ThePrimeTime
comments
Comments by "Mikko Rantalainen" (@MikkoRantalainen) on "Bjarne Says C++ Is Under Attack" video.
C++ is now 40 years old and people are still creating lots of memory safety issues with it so it's clearly the problem. If C++ was great and this would be only about skill issue, we would have figured out a correct way to teach C++ to new programmers by now. I was lucky enough to have a great teacher in the university while learning C++ and I already knew Pascal, symbolic assembly and C before even trying to learn C++ which probably helped, too. C++ has always been about maximum runtime performance, not about memory safety or thread-safe code. Rust is the other way around: it's safe first and then maximum possible runtime performance as second. And the safety in Rust does include memory safety, but thread safety is even more important in my books. In fact, Rust is the only commonly used language that enforces thread safe code and still allows high performance multi-threaded code with shared memory structures. Even Java requires the programmer to manually mark synchronized methods and if one mark is missing, the compiler doesn't complain about it but the program just misbehaves (typically apparently randomly because it's a race condition which is often the hardest issues to solve). Sure, it's possible to write correct code in C++ but most people are not able to do it because the language doesn't provide enough support and programmer simply must write perfect code every time. That said, I personally like to apply RAII style to any language with predictable destructors but I'm fully aware that most people do not follow similar style accurately enough.
1
6:50 I think the problem is that Stroustrup can write perfect C++ code and he thinks that memory safety problems are just skill issue and the language is fine. He cannot understand that even among software developers (which are typically way above average already) he is an exception and majority cannot write perfect C++ code every time no matter how hard they think about the code. If the C++ compiler accepts code with invalid pointer access, use-after-free, racing between threads, buffer overflows and other kind of mistakes without ever displaying even a single warning, the language is simply too hard to use correctly for most developers. I personally like C++ but I use it more like I'm writing mathematical proofs than quickly hacking something together. If you are not a perfectionist and like to write meticulous code, C++ is not the correct language for you.
1
If you actually check how the proposed Safe C++ would work, it's basically Rust with C++ syntax and you still have to explicitly opt-in to Safe code everywhere or the compiler will happily accept unsafe code. And the fact that Safe C++ has all the same core concepts as Rust (ownership, borrow checker) simply shows how close to best known design for a safe language Rust already gets. I think the syntax of Rust is far from optimal for human understanding but when I look at the template syntax of C++, I'm not expecting Safe C++ to be easier to use than Rust. This is because C++ template programming is already hard enough and Safe C++ extends the syntax even more and still allows full template programming. And make no mistake, easy to use is an important language feature. Rust is already considered too hard for many developers. If Safe C++ is harder to use, do you expect lots of traction for that?
1