Hacker News new | ask | show | jobs
by thesuperbigfrog 814 days ago
>> is there ever a case for doing a project in C++ (outside of being forced by the platform you’re working on or anything outside your control)?

No.

That is part of the reason why so many big companies (Google, Microsoft, Amazon, etc.)[1][3][4] are pushing ahead on Rust adoption and large government agencies[5][6] are recommending memory safe languages over C and C++.

Google did a study and found that their Rust developers were twice as productive as their C++ developers [2].

Rust should be preferred over C++ unless you have no other choice.

[1] https://thenewstack.io/google-spends-1-million-to-make-rust-...

[2] https://www.theregister.com/2024/03/31/rust_google_c/?td=kee...

[3] https://www.theregister.com/2024/01/31/microsoft_seeks_rust_...

[4] https://blog.qwasar.io/blog/why-is-rust-growing-and-why-do-c...

[5] https://www.nsa.gov/Press-Room/Press-Releases-Statements/Pre...

[6] https://www.whitehouse.gov/wp-content/uploads/2024/02/Final-...

2 comments

Yes, this is all very interesting, I've found golang is significantly simpler to get up to speed on from a c-family based education (c/c++/java) so I'm curious if these teams were both proficient before starting the projects. (And 3rd party package comparisons come into play). Either way enough to keep an ear out as I'm sure with the wealth of python & js developers the language of choice will be promoted by their experiences/evolution (so suspect mojo will also be something to keep an eye on)

(Notably I've gone through this evaluation recently and landed on implementing my personal project in c++23 (using cosmopolitan if possible) mostly for the value of updating my c++ knowledge (and perhaps look into cuda))

>> I've found golang is significantly simpler to get up to speed on from a c-family based education (c/c++/java) so I'm curious if these teams were both proficient before starting the projects.

Coming from a similar background, I have found Golang to be a nice, more efficient replacement for Java because it works great for backend web services, middleware, etc. Go is easy to learn and brings most of what is needed in its standard library (similar to Java).

Rust's sweet spot is where C and C++ shine: performance critical, maximum efficency required software such as operating system components, device drivers, media applications, etc.

Rust does have a learning curve, but most of what it enforces are best practices: 1) multiple readers or one writer resource usage, 2) organizing code hierarchy into trees, 3) sane patterns for concurrency, etc.

Go is great, but it has garbage collection (you don't manage memory directly) whereas c++ and rust do not.

It is apples and oranges, in that regard. Some node guy isn't going to just go and pick up rust/c++ because they're used for quite different purposes.

As a general purpose language, Go is amazing. In fact, it is what I use day to day for all my needs. For my current business needs it is what all our services are written in. They are fast, and the go concurrency model honestly makes it pretty easy for me to forego a lot of extra add-on technologies that are not yet required at my stage and KISS.

For anything like super high perf, systems programming, embedded, etc. you will want to use c++ or rust.

Thanks for all the sources! Especially surprised on the Google one, used to work there and remember hearing that considerable parts of Fuchsia (https://en.m.wikipedia.org/wiki/Fuchsia_(operating_system)) were written in Rust but didn’t know they were also conducting studies across the org about how much more productive eng were with it. Pretty cool