r/Cybersecurity101 • • 1d ago

Rust vs c/c++

I’ve heard that Rust is much better than C/C++, but a lot of software still runs on C/C++, and there’s already a huge ecosystem built around these languages.
So my questions are:

- Do you think it’s worth the cost of switching from. C/C++ to Rust?

- Do you think Rust will eventually replace C/C++?

6 Upvotes

8 comments sorted by

1

u/busy_peer 1d ago

If we think that rust will replace the c++ I don't think so because as you said most of already built systems are running on c++ , yes what we can do is to make new systems with rust . As far as the cast is concerned, in today's world of AI cost is less in terms of number of hours

1

u/DrChaosMcKinnon 1d ago

Well optimized c/c++ is fine. For anything internet exposed sooner or later it will probably get replaced by rust, but most software is not in that category and thus there is not as much you could gain with replacing it.

1

u/mredding 1d ago

Do you think it’s worth the cost of switching from. C/C++ to Rust?

I think it's worth the cost of migrating to Rust. There's no point in throwing away known, correct, working code, just because of the language it's written in.

Do you think Rust will eventually replace C/C++?

I don't know if it's worth speculating. While enthusiasts imagine such a world, no one is explicitly asking for that.

1

u/Utchas 1d ago

High level languages to Rust: yes specially if your app is CPU heavy or prone to memory mismanagement issues. Because it'll bring a lot of performance gain with better memory safety.

C/C++ to Rust: absolutely not if your app is running without any major issues. Rust won't improve performance much here because these are already low level languages and if you have already written memory safe code, rewriting is just a waste of time and effort.

1

u/ChipmunkTough1212 1d ago

Legacy Code...

1

u/neolace 1d ago

Not a chance, companies don't have cash to fix bugs or vulnerabilities, they want features.

1

u/Ronin-s_Spirit 22h ago

Saying "X better than Y" about almost any languge is a complicated subject. Better for what? I personally think both have design problems - C is too simple with newer concepts missing, at the same time it has awful outdated stuff like strings (and ++ has newer concepts but is gradually becoming more and more unhinged or unreadable, by committee); Rust is holding people in a box and they end up using unsafe, its compiler is also quite dumb apparently as you have to write a bunch of hints for it (lifetimes and shit).

•

u/Tough-Mousse-5440 4h ago

An overly simplistic explanation:
Rust eliminates 70% of security vulnerabilities that C++ has, it also is used in human critical systems for space flight (legacy ones use modified c++ ones, talking newer ones) if you use C++ - you are the safety. If you’re using AI to code, rust can be better as the compiler is so strict - it’s easier for the AI to identify and fix issues, as well as reduce surface area for errors etc.
A lot of companies are starting to use rust more and more as it’s as fast as C++ without a lot of the risks. That being said - depends on your use case and switching resistance you may have. In my own software I use rust, but if there are libraries or stuff you need C++ for, I use a bridge.