Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Merely being safer than c++ is enjoyable because I don't have to be quite so paranoid about introducing bugs.

Also rust has some more modern functionalish constructs like lambadas and pattern matching.



> Merely being safer than c++ is enjoyable because I don't have to be quite so paranoid about introducing bugs.

For those times when you have to use C++, SaferCPlusPlus[1] should help.

[1] shameless plug: https://github.com/duneroadrunner/SaferCPlusPlus


How does it help to make everyone on the team play ball to not use C style coding or the quality of third party libraries?

If the answer is code review, it will never work.


I can certainly appreciate the sentiment that one of the most valuable features a language can have is the ability to make your co-workers write better code :) And it's hard to compete with Rust in that sense. That is, if you're starting a brand new project.

But in other circumstances, another valuable feature would be to be able to make your co-workers' (and predecessors') existing code retroactively safer. The easiest way to do that is probably by enabling the llvm/gcc sanitizers when compiling. But unfortunately that is often not a practical solution for several reasons[1], not least of which is the performance penalty.

So the more practical solution may be to use SaferCPlusPlus to replace (in a straight-forward but not quite automated manner) all the potentially dangerous C/C++ data types (pointers, arrays, etc.) with safe, fast compatible direct substitutes. Thereby salvaging existing code bases.

Wrt preventing the use of C/C++'s unsafe data types in new code, currently SaferCPlusPlus does not provide any mechanism for such enforcement. But you could imagine the effort required to implement such an enforcement mechanism might be small compared to rewriting some large code bases in, say, Rust. And in the mean time, even existing C++ static analyzers seem to be getting better at flagging potentially unsafe code.

[1] http://duneroadrunner.github.io/SaferCPlusPlus/#safercpluspl...


The main reason I only have fun using C++ on private projects, while using JVM and .NET languages at work is exactly the way most people use the language on the enterprise.

The majority of C++ programmers I meet at enterprise projects don't even know what is CppCon.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: