4 ms·
Ugh. You've basically made the case for me doing my next project in c++ 17 instead of using it as an excuse to learn Rust. Im morally opposed to c++....
by aswanson 7y ago
Ugh. You've basically made the case for me doing my next project in c++ 17 instead of using it as an excuse to learn Rust. Im morally opposed to c++....
- iamwil 7y agoisn't protection against de-referencing null pointers a good reason?
- aswanson 7y agoYeah, but I've been around the block enough times to avoid those types of bugs.
- apta 7y agoIt's much more than just null pointer dereferencing. Time and time again, it's been proven that Rust protects even very experienced C++ programmers from bugs they didn't realize they're even making.
- MaxBarraclough 7y agoThis is a good point. Personal assurances count for little. No-one is above writing buggy code. Even C/C++ codebases written by very expert programmers, often have pointer-based bugs, especially if large and complex. Operating systems and drivers, for instance. As well as having free-form pointers, C/C++ also have many, many dark corners. What proportion of C++ programmers know that comparison = (c == c++); causes undefined behaviour?
- MaxBarraclough 7y agoIn C++'s defence, the language itself doesn't mandate any protections here (the famous 'undefined behaviour'), but there's no reason your compiler can't add automatic runtime checking against illegal use of null. GCC supports it with "-fsanitize=null" [0] [0] https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.h...