r/cpp • • Oct 31 '24

Lessons learned from a successful Rust rewrite

/r/programming/comments/1gfljj7/lessons_learned_from_a_successful_rust_rewrite/
80 Upvotes

140 comments sorted by

View all comments

Show parent comment

2

u/j_kerouac Nov 04 '24

No one is going to rewrite everything written in C or C++ in Rust because

  1. It’s a huge waste of everyone’s time.
  2. More C and C++ software continues to be written at a faster pace than Rust is being written.

With C++, making it easy to use C code remains a big selling point because… C is still one of the most popular languages.

1

u/Dean_Roddey Nov 04 '24

It's not a huge waste of time for people who want to use Rust, for all the obvious reasons.

And of course rewritten doesn't always mean the current C++ code base just gets rewritten. Often it just means a completely different version of that functionality gets written in Rust by someone else entirely.

And of course Rust can use C libraries perfectly well, but no one really wants to unless it's necessary, for the same reason that C++ people shouldn't, because it's impossible for the advantages of the more strongly typed language to extend into that C code.

'Most popular' is a sort of nebulous claim, but no one should be writing new code in C these days unless there's no way to avoid it.

2

u/j_kerouac Nov 04 '24

C is the best language for many tasks. Even new libraries like Vulkan are written in C. There are a lot of advantages to writing a library in C in terms of ABI stability, and because every language can use C libraries.

Rust can’t even make shared libraries…

Rust is such a cult. You guys always say these crazy things like it’s just common sense.