Hacker News new | ask | show | jobs
by foofie 897 days ago
> Rust actually is a nice language. C++ requires deciding which features to use?

With Rust you have to choose which features to use. Unlike C++, with it's "you pay for what you use" model, Rust's features are arguably still broken, unstable, and under active development. See async rust for example.

> don’t know modern C++ but it seems to have a kind of cult like indoctrination where everything else is wrong and only each persons flavor is correct leading to endless bike shedding.

Indeed you don't know what you're talking about. Adopting a style guide is not the same thing as joining a cult.

C++ has been in active use for around 30 years, and modern C++ for over a decade. People use it just fine, and don't feel the need to evangelize. Other communities sadly still appear to feel a constant need to reassure and convince themselves they didn't made the wrong choice.

1 comments

Should I use boost style? Qt/Eigen styling? Can I get a subset of the language and stdlib without allocations? Should I use multiple inheritance with I classes or template duck typing? What’s the cycle and storage cost of smart pointer wrappers? Atomics kill pipelines and caches. Yeah the zero cost isn’t actually zero cost sorry to say. Are closed over stack variables moved or referenced? If referenced, what happens if the closure outlives the call context?
Google style guide is good tbh.

You should use the right tool for the job.

std::unique_ptr is just a move-only ergonomics type over a bare pointer, it doesn't have extra state. std::shared_ptr is basically no different than Rust's Arc.

Closures specify capture semantics explicitly, so you will always know, and default to copy.

And yes, you can capture local references and leave. Don't do that, or return references to local variables, or lots of other fun stuff.

> Should I use boost style? Qt/Eigen styling?

You use whatever you wish to use. You can also waste time debating whether you should name your variables in camelCase or snake_case. It doesn't matter, and no one will berate you for whatever choice you made.

It's your call. Do you think that having a choice is bad?