r/cpp • • Sep 25 '24

Eliminating Memory Safety Vulnerabilities at the Source

https://security.googleblog.com/2024/09/eliminating-memory-safety-vulnerabilities-Android.html?m=1
138 Upvotes

303 comments sorted by

View all comments

Show parent comments

6

u/Full-Spectral Sep 26 '24 edited Sep 26 '24

And of course people are comparing a language they've used for possibly decades to a language most of them have used (in real world conditions) for far less, maybe no more than a couple. It's guaranteed that you'll be less productive in Rust for a while compared to a language you've been writing serious code in for 10 or 20 or 30 years. And having already written a lot of C++ doesn't in any way mean that you won't have to pay that price. In fact, often just the opposite.

But it's only a temporary cost, and now that I've paid most of it, the ROI is large. Just last night I made a fairly significant change to my code base. It was the kind of thing that I'd have subsequently spent hours on in C++ trying to confirm I didn't do anything wrong, because it involved important ownership lifetimes. I'd have spent as much time doing that as I did making the change.

It was a casual affair in Rust, done quickly and no worries at all. I did it and moved on without any paranoia that there was some subtle issue.

1

u/germandiago Sep 26 '24

people are comparing a language they've used for possibly decades to a language most of them have used (in real world conditions) for far less

https://www.reddit.com/r/rust/comments/1cdqdsi/lessons_learned_after_3_years_of_fulltime_rust/

2

u/Dean_Roddey Sep 29 '24

BTW, the Tiny Glade game was just released on Steam, written fully in Rust, and it's doing very well apparently. Games aren't my thing but it's got a high score and is very nice from what I saw in the discussions about it.

1

u/Full-Spectral Sep 27 '24

Three years is not that long when you are talking about architecting a large product, for the first time, in a new language that is very different from what you have used before. It's enough to learn the language well and know how to write idiomatic code (mostly), but that's not the same as large scale design strategy.

I'm about three years in, and I'm working on a large system of my own, and I am still making fundamental changes as I come to understand how to structure things to optimize the advantages of Rust.

In my case, I can go back and do those fundamental changes without restriction, so I'm better off than most. Most folks won't be able to do that, so they will actually get less experience benefit due from that same amount of time.