News for hackers. Stuff that matters.
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri... by kevincox on Wednesday March 31, 2021 @11:58AM (#26648876)
I think the answer is yes. Most C++ projects would be better served by Rust. However there are many caveats:

- I think that C++ devs are still more numerous than Rust devs.

- There are many excellent C++ libraries that don't yet have great Rust bindings. Furthermore it is unlikely that template-heavy libraries will ever be easy to use from Rust.

- C++ is supported on more platforms.

- C++ is more powerful. (Particularly templates). You rarely need more power than what is available in Rust but if for whatever reason your project would really benefit from heavy meta-programming C++ will be better. (I think this case is rare). Rust is also catching up, but the language development, especially around generics is fairly slow (which is probably a good thing)

Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri... by zozbot234 on Wednesday March 31, 2021 @12:17PM (#26649149)
Meta-programming needs in Rust are addressed by macros. There's not really anything missing there compared to what C++ does via templates.
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri... by steveklabnik on Wednesday March 31, 2021 @12:34PM (#26649373)
IMHO, you're a bit too far in the other direction; there are areas where we've been working on actively improving, and there are still some things that C++ folks really miss in Rust. Doesn't mean we'll add all of them, of course, but there is desire for more, for good reasons.
Re:Android's new Bluetooth stack rewrite (Gabeldorsh) is wri... by kevincox on Wednesday March 31, 2021 @12:51PM (#26649643)
There are generics and dependent types. But these are still gaining features and not nearly as powerful as templates and SFINAE. (but way easier to understand)

Macros are an option but don't have access to the same type information so often they solve different problems.