News for hackers. Stuff that matters.
Re:What it feels like when Rust saves your bacon by bestouff on Friday June 24, 2022 @05:15AM (#31859397)
Yeah no. In my experience, when several people commit to a common C/C++ codebase this kind of issue become really exhausting when it happens more than once, and the symptoms may be so subtle it's a bitch to debug.

Rust lowers your mental load. You spend more time being creative and way less time debugging "obvious" (or not) mechanical problems (reference not-on-stack-anymore variables, use-after-free, concurrent write access and all kind of compiler undefined behavior). That why garbage collected languages are so successful (they let you concentrate on the business logic) and for the first time it's available in a system language.

Everything that can be done by your computer should be done by your computer. You should leave your precious brain cells available for the important stuff.

Re:What it feels like when Rust saves your bacon by shuger on Friday June 24, 2022 @05:29AM (#31859486)
I work in probably what is considered one of the least "safe" languages: C++

The issues that Rust is supposed to help with are simply not what we spent time on. All the bugs reported are pretty much exclusively root caused to "business logic".

From recent time I can recall only one that was a programming mistake and not architecture/business logic related. It was a missing break in a switch that already had some fallthroughs so it didn't look incorrect at a glance.

I do understand what Rust is supposed to provide but in practice it's simply an extremely minor source of bugs.

Re:What it feels like when Rust saves your bacon by jackmott42 on Friday June 24, 2022 @10:09AM (#31862088)
I see many C++ programmers say stuff like this, and maybe it is the case that studios exist which can do C++ without mistakes related to memory management or sigils and so on, but I also observe that:

1. High quality teams like the Linux kernel team and PostgreSQL, do periodically have serious security bugs that are things Rust would have caught.

2. I see sometimes C++ instructors making the same claims you do and then spending half of a lesson tracking down a memory mistake, (Casey Muratori) or in the same month a tweet from a game engine developer saying they don't really see the value of garbage collection and then tweeting about how they spent 48 hours tracking down a memory mistake. (of course, for a game engine that is what you have to do sometimes!)

There are however valid questions, like if Rust slows down your development say, 5%, would you get more net safety from spending 5% more time testing/fuzzing c++ code instead? etc.

Re:What it feels like when Rust saves your bacon by jandrewrogers on Friday June 24, 2022 @03:23PM (#31868083)
> High quality teams like the Linux kernel team and PostgreSQL

Neither of those code bases are C++, which significantly dilutes your point. A major benefit of modern C++ is that it is much safer than the language Linux and PostgreSQL are written in.

Re:What it feels like when Rust saves your bacon by Daishiman on Friday June 24, 2022 @04:15PM (#31868709)
Chromium _is_ written in C++, has some of the best coders and one of the best-tested codebases in the world. They're still finding zero-days based on exploits due to the language's failings.

There's a reason Mozilla has decided that all parser code should be moved to Rust ASAP.

Re:What it feels like when Rust saves your bacon by melissalobos on Friday June 24, 2022 @02:12PM (#31866904)
> High quality teams like the Linux kernel team

Which very notably does NOT use C++.

Re:What it feels like when Rust saves your bacon by csdreamer7 on Friday June 24, 2022 @03:16PM (#31867987)
Nor does Postgres.
Re:What it feels like when Rust saves your bacon by jesse__ on Friday June 24, 2022 @10:27AM (#31862414)
I'd venture that the development slowdown from using rust is closer to 50% than 5%. Even just compile times probably slow down that much, not to mention you have to write (sometimes) as much as 10x code to express yourself.

The specific exercise I have in mind is a lockless thread queue. < 20 lines in C .. ~200 lines in Rust.

Re:What it feels like when Rust saves your bacon by Yoric on Friday June 24, 2022 @01:27PM (#31866165)
My anecdotal experience is the opposite.

I write code much faster in Rust than in C++. Part of it is thanks to the type system – fewer opportunities for dev errors means that I can produce code that is more concise, spends less time handling runtime errors because I can have static guarantees that they have already been handled somewhere, etc. Part of it is #[derive(...)], great documentation, Cargo and other QoL components of Rust.

Re:What it feels like when Rust saves your bacon by jesse__ on Saturday June 25, 2022 @11:03AM (#31875855)
Fair enough. I can imagine if you largely write code that plays nice with the compiler it could be faster. That just hasn't been my experience.
Re:What it feels like when Rust saves your bacon by __jem on Friday June 24, 2022 @03:09PM (#31867857)
> The specific exercise I have in mind is a lockless thread queue. < 20 lines in C .. ~200 lines in Rust.

Why is this your exercise you have in mind though? This is such a bad argument. Like, yes, if you work at doublylinkedlist.com where your entire job is writing a new linked list implementation every day of the week, Rust might be a bad choice. But that's not what any kind of commercial enterprise actually looks like. If I saw you writing a lockless thread queue at work, I'd tell you to stop wasting time.

Re:What it feels like when Rust saves your bacon by jesse__ on Saturday June 25, 2022 @11:00AM (#31875841)
>> Why is this your exercise you have in mind though?

That was an example I could point to where the code size difference between Rust and C or C++ is roughly 10x. I mentioned it to corroborate the claim that sometimes writing Rust is very verbose, on the order of ten times more.

My point was not that average commercial codebases are largely dominated my these types of structures. My point was that my experience with Rust has been that the development slowdown is much more than 5%, as the OP suggested.

>> If I saw you writing a lockless thread queue at work, I'd tell you to stop wasting time.

And that's one reason we don't work together ;)

Re:What it feels like when Rust saves your bacon by pkulak on Friday June 24, 2022 @11:09AM (#31863382)
A lockless thread queue (not entirely sure what that would be, sorry; a queue in front of a pool?) seems like the kind of low-level library that could be written with liberal use of unsafe. No need to flagellate yourself on the altar of compile-time safety.
Re:What it feels like when Rust saves your bacon by jesse__ on Saturday June 25, 2022 @11:04AM (#31875859)
Then why would I use rust in the first place?
Re:What it feels like when Rust saves your bacon by ColonelPhantom on Sunday June 26, 2022 @04:53AM (#31882218)
So that you can write "primitives" such as a queue in unsafe, and assuming it is correct, it is not possible to introduce bugs from other code.

Also, things like queues tend to be implemented in either the stdlib or a very popular library. So they are very well tested and likely to be widely reviewed.

Re:What it feels like when Rust saves your bacon by jackmott42 on Friday June 24, 2022 @10:33AM (#31862545)
I'm sure there is a ton of variance. I have done some Rust projects where I run into absolutely no safety complaints from Rust because it just isn't the kind of code that does anything the borrow checker cares about. For those development time ends up typically faster than C/C++ due to various syntax and tooling niceties.

Other projects will really get into domains where you have to work hard to satisfy the borrow checker and it can slow you down a lot. In a real application you won't be writing lockless thread queues for a big % of the time. But then for a real application the compile times will start to weigh on you more. (Though, C++ does not always compile fast either unless some care is taken to be sure it does)

Re:What it feels like when Rust saves your bacon by ttfkam on Saturday June 25, 2022 @10:52AM (#31875761)
And you're running at least one static analysis tool and a linter on your C++ code too, right? You're not just deploying the C++ compiler output as-is, right?

Those take time to run too and should absolutely be added to the compile time metrics when comparing against "cargo build".

Re:What it feels like when Rust saves your bacon by jesse__ on Saturday June 25, 2022 @11:12AM (#31875911)
On a personal project I run 2 metaprogramming passes, compile the entire project (~2m LoC) _twice_ and run the entire test suite in < 30s on a laptop from 2010.

I don't run a linter because I hate them, and my metaprogramming passes do a bit of extra static checking clang doesn't. I occationally run extra static tools (valgrind et. al) but they're painfully slow and very rarely catch anything.

Re:What it feels like when Rust saves your bacon by kaba0 on Saturday June 25, 2022 @01:37PM (#31877123)
Rust in incremental build mode is not slow at all, I really don’t see why people say so.
Re:What it feels like when Rust saves your bacon by kajaktum on Friday June 24, 2022 @10:51AM (#31862966)
>The specific exercise I have in mind is a lockless thread queue. < 20 lines in C .. ~200 lines in Rust.

Do they have an equivalent API? Rust does have a hard time explaining very, very low level stuff that you'd have to do unsafe and various magicks. But once you get the unsafe details right, the consumer API for them tends to be extremely rigid and fool proof.

Re:What it feels like when Rust saves your bacon by jnordwick on Saturday June 25, 2022 @12:22AM (#31872596)
> Rust does have a hard time explaining very, very low level stuff

A little odd for a supposed system langauge

Re:What it feels like when Rust saves your bacon by kaba0 on Saturday June 25, 2022 @01:32PM (#31877072)
But it is just not true. Rust has a hard time writing algorithms where objects don’t have a singular owner. That’s all, it is not low level stuff. It for example has proper SIMD support, while the supposedly low level c doesn’t.
Re:What it feels like when Rust saves your bacon by mcronce on Wednesday June 29, 2022 @12:21PM (#31922293)
This is an ... interesting argument. "I can't write this 200LOC component of a large codebase in safe Rust, so what's the point in Rust?"
Re:What it feels like when Rust saves your bacon by 3a2d29 on Friday June 24, 2022 @01:14PM (#31865942)
> High quality teams like the Linux kernel team and PostgreSQL, do periodically have serious security bugs that are things Rust would have caught.

Safe rust would have caught. If you had to drop into unsafe to do what they did, the serious security bugs would still have happened.

Re:What it feels like when Rust saves your bacon by jackmott42 on Friday June 24, 2022 @02:21PM (#31867072)
A fair point, though the few security issues in recent years I've looked at were not the kind of thing you would turn to unsafe rust for. But I've certainly not done a broad enough sampling to say what % of cases are like that.
Re:What it feels like when Rust saves your bacon by 3a2d29 on Friday June 24, 2022 @02:51PM (#31867600)
To be fair, I am sure Rust catches a fair amount (compared to C++ which would catch 0). I just think that phrasing rust has having 0 memory errors can be a tad inaccurate.
Re:What it feels like when Rust saves your bacon by ttfkam on Saturday June 25, 2022 @10:25AM (#31875552)
Except when something goes wrong, you can typically focus all your attention on the unsafe blocks, which should be a very small portion of your codebase, if it exists at all. (Contrary to popular belief, unsafe Rust code is neither mandatory nor widespread.)

By contrast and comparing apples to apples, your entire C or C++ codebase is the equivalent of one giant unsafe block. You can bring in 3rd party tools to perform some of the static analysis the Rust compiler does for you, but call it for what it is.

By default, Rust is safe while C & C++ are not.

Re:What it feels like when Rust saves your bacon by boris on Friday June 24, 2022 @11:31AM (#31863751)
> There are however valid questions, like if Rust slows down your development say, 5%, would you get more net safety from spending 5% more time testing/fuzzing c++ code instead? etc.

I think a similarly valid question is how often you resorted to dynamic allocations just to get the borrow checker off your back. If your Rust version uses 5% more dynamic memory (with the corresponding performance and memory footprint penalty), is it perhaps worth staying with C/C++ and spending more development time on testing/fuzzing?

Re:What it feels like when Rust saves your bacon by duckerude on Friday June 24, 2022 @02:01PM (#31866715)
Some people make the opposite claim: Rust lets you get away with less dynamic allocation (and more data shared between threads) because you can rely on the compiler checking your work.

The effect might be positive or negative depending on the circumstances.

Re:What it feels like when Rust saves your bacon by smolder on Friday June 24, 2022 @12:24PM (#31864921)
If you're willing to jump back to C++ to get around the borrow checker strictness, couldn't you just use Rust's unsafe block where you're sure it won't result in a bug?

Is it harder to fuzz Rust? Honest question, because fuzzing is something I occasionally read about but am not practiced in.

Re:What it feels like when Rust saves your bacon by duckerude on Friday June 24, 2022 @02:12PM (#31866902)
I've found it very easy to get started with fuzzing in Rust using cargo-fuzz. I didn't do anything very advanced, and my closest point of reference is testing Python with Hypothesis, but it did turn up bugs.

Here's a Rust fuzzing story from yesterday: https://hacks.mozilla.org/2022/06/fuzzing-rust-minidump-for-...

It claims that Rust is particularly suitable for it because integer overflow panics in debug builds (and out of bounds indexing always panics), which sounds reasonable.

Re:What it feels like when Rust saves your bacon by ttfkam on Saturday June 25, 2022 @10:42AM (#31875685)
> And what did we screw up? Some legit stuff! It’s Rust code, so I am fairly confident none of the issues were security concerns, but they were definitely quality of implementation issues, and could have been used to at very least denial-of-service the minidump processor.

This is so much better than the outcome would have been in any C or C++ project despite the many protestations of "just follow modern best practices" adherents. The author of minidump is no novice, is well versed in best practices in multiple languages including C++, was sure the code was solid, and still got spanked hard by the fuzzer. Denial of service outcomes aren't ideal, but they were likely fewer in number and are unambiguously better than security vulnerabilities.

Re:What it feels like when Rust saves your bacon by jackmott42 on Friday June 24, 2022 @02:19PM (#31867050)
That is a fair thing to wonder about, but at the moment most of the design decisions Rust pushes you toward tend to be better for performance on modern hardware. For instance using an array based arena to store a graph, instead of the traditional allocation of a chunk of memory per node on the heap. Or just keeping more stuff on the stack.
Re:What it feels like when Rust saves your bacon by jnordwick on Friday June 24, 2022 @10:50PM (#31872049)
But it takes a lookup hit and you need an arena per object type with its memory overheard. You'll get more cache misses.

A lot of the rust performance talking points just aren't true. Rust is slower than C and C++, not by much but you can't get a true believe to even recognized this. Rust has turned into a religion.

Rust also disallows some things that you can do fine on C++ if you know our architecture because thing won't work on some machine 20 years ago (eg, it has more strict alignment requirements than any machine a consumer can see).

Throughput may only be 5% or more slower, but latency issues for rust is a much bigger issue. The devs I've talked to don't even try to pretend they have a good latency profile.

Re:What it feels like when Rust saves your bacon by staticassertion on Friday June 24, 2022 @11:21PM (#31872264)
The linux kernel is absolutely anything other than high quality lol
Re:What it feels like when Rust saves your bacon by strictfp on Friday June 24, 2022 @05:47AM (#31859599)
I've worked in a variety of languages, and returning to a c++ project recently I do see that we spend a lot more time thinking about how to write the code in a way that avoids problems. Meaning that there's a lot more architecturing required to reach a sane state.

We have a sister product written in a dynamic language, and sometimes we have identical functionality.

I've noticed that when a change is discussed, the c++ gang has architectured themselves into the current solution and therefore have a much harder time making changes.

So for that reason I think it's easy to overlook these complexities when you're working in c++ alone; they feel natural and are just part of how you work. You forget that a lot of this architecturing just isn't necessary in a lot of other languages.

Re:What it feels like when Rust saves your bacon by jstimpfle on Friday June 24, 2022 @06:28AM (#31859825)
Maybe I'm wrong, but I believe that most of the architecting that you describe would be effectively what you do with regards to performance as well: Minimizing change of ownership, moving to a system with more static allocations with fewer "objects" that are linked into a variety of subsystems.
Re:What it feels like when Rust saves your bacon by strictfp on Friday June 24, 2022 @07:28AM (#31860217)
Yes, that's true. In a sense, c++ requires good code structuring.

That's also part of why I enjoy returning to c++, the people involved know how to structure code and create clean architecture.

That said, sometimes c++ does get in the way. Creating trees or graphs can be cumbersome, and IMO it's very biased towards virtual methods to solve polymorphism.

Extending lifetimes by pooling or similar is also quite common, and is in my eyes sometimes overdoing it. If you for instance use Rust, you can be a lot more confident that the compiler catches these issues, and be more conservative and efficient in the solution.

Re:What it feels like when Rust saves your bacon by jandrewrogers on Friday June 24, 2022 @08:42AM (#31860881)
> very biased towards virtual methods

This is a function of the type of software you write. There are many large C++ code bases that rely on various types of static polymorphism almost exclusively, rarely having a use case for virtual methods or dynamic polymorphism. There is a similar story with inheritance versus composition; some types of code bases naturally gravitate toward one or the other.

The nice thing about C++ is that it as amenable to any of these models should it benefit the application.

Re:What it feels like when Rust saves your bacon by strictfp on Friday June 24, 2022 @01:27PM (#31866156)
I don't agree. The support for static polymorphism is in it's infancy at best.
Re:What it feels like when Rust saves your bacon by jandrewrogers on Friday June 24, 2022 @03:27PM (#31868153)
Can you give some examples of what you mean? I use static polymorphism in C++ routinely and haven't felt particularly limited by it.
Re:What it feels like when Rust saves your bacon by strictfp on Friday June 24, 2022 @07:04PM (#31870620)
Sure. I guess template-based polymorphism is alright for code dispatch. But if you want to store the different types of objects involved you have limited choices. There's no straight-forward support for sum types. std::variant is fairly new, has a cumbersome API, and is quite slow (ballpark the same as virtual calls). There's no support for methods on enums nor anything for customizing the fields of different enum constants. There's also no pattern matching or other really convenient way of deconstructing variants.

So while it's there, I would say that the oo virtual method style is much better supported, although storage for those usually requires some type heap allocation.

Re:What it feels like when Rust saves your bacon by jandrewrogers on Saturday June 25, 2022 @04:14AM (#31873446)
Okay, yeah, I would broadly agree with this. I think most people use template-based polymorphism, which is pretty flexible in practice. The use of virtual methods is verboten for many common use cases of C++, due to the necessity of being in paged memory, so constructions for dealing with polymorphism without virtual methods are commonplace. And std::variant is a bit of a hot mess.
Re:What it feels like when Rust saves your bacon by strictfp on Saturday June 25, 2022 @04:54AM (#31873608)
> The use of virtual methods is verboten for many common use cases of C++, due to the necessity of being in paged memory

I wasn't aware of this. Maybe I'm just out of the loop. Do you know where one can I learn more about this? I'm desperately trying to reduce the number of virtual calls in our codebase, but I'm hitting the aforementioned problems.

Re:What it feels like when Rust saves your bacon by jandrewrogers on Saturday June 25, 2022 @09:24AM (#31875114)
It is a design problem endemic to database engines and probably file systems. A design requirement for most of the dynamic runtime data structures is that they can be directly paged to storage, either in whole or in part, and be paged from storage in an arbitrarily distant future on different machines with different compilers. In order to make this work, all data types used in pageable data structures must 1) have a size and alignment that is not compiler-dependent so that page types always have a size that is a strict multiple of the I/O page size and 2) not contain any pointers. This precludes vtables.

This has traditionally been managed with CRTP, tagged unions, etc with some scaffolding to make it convenient and compliant with strict aliasing rules. Ideally, almost all of the dynamic polymorphism is pulled up to the level of the page types, an opaque blob of I/O friendly complex data structure, minimizing the amount you have to do. It is also important to note that JIT-ing has replaced many of the use cases for dynamic dispatch e.g. adding user-defined schemas at runtime.

None of which may apply to your use case. Some things inherently require an unfortunate amount of dynamic dispatch.

Re:What it feels like when Rust saves your bacon by heisjustsosmart on Saturday June 25, 2022 @09:47AM (#31875275)
Virtual methods are about dispatch tables (which are built at compile time) and have nothing to do with paging. Nothing. At all.
Re:What it feels like when Rust saves your bacon by riking on Monday June 27, 2022 @06:27PM (#31901704)
"hmm, you call it an 'enum class' yet somehow I cannot define methods on it"
Re:What it feels like when Rust saves your bacon by jhgb on Friday June 24, 2022 @10:23AM (#31862351)
> and IMO it's very biased towards virtual methods to solve polymorphism.

Is it? These days I'd expect C++ to be very biased towards using templates for polymorphism. After all, templates are a thing that C++ provides with functionality that other languages often lack, whereas in the field of virtual methods/"dynamic dispatch OOP" C++ severely lags behind other languages. Choosing between two features of a language and using exactly the one that is worse in comparison to your competition feels wrong to me.

Re:What it feels like when Rust saves your bacon by FpUser on Friday June 24, 2022 @12:42PM (#31865299)
I do not think C++ "lags severely in the field of virtual methods". I use both OOP and template based polymorphism depending on particular needs and see no significant problems in either.
Re:What it feels like when Rust saves your bacon by jhgb on Friday June 24, 2022 @01:16PM (#31865977)
C++ can't do things today that Smalltalk and CLOS were able to do in the 1980s already; how is it not lagging behind in OOP? Hell, companies like Trolltech had to extend C++ for their own purposes to provide just a subset of the extra features (relative to standard C++) that had already been available in environments like Smalltalk or CLOS.
Re:What it feels like when Rust saves your bacon by ryl00 on Friday June 24, 2022 @10:14AM (#31862183)
> Creating trees or graphs can be cumbersome

Wouldn't Rust have the same problem with this (if not worse)?

Re:What it feels like when Rust saves your bacon by jhgb on Friday June 24, 2022 @10:28AM (#31862443)
I was told that deferred_ptr/deferred_heap was supposed to solve these things for C++, so perhaps that would make Rust the option with worse problems in this department. Not sure where it got by now, though.
Re:What it feels like when Rust saves your bacon by leni536 on Friday June 24, 2022 @09:21AM (#31861346)
Sometimes (definitely not always) you can use std::function instead for dynamic polymorphism.
Re:What it feels like when Rust saves your bacon by cyber_kinetist on Friday June 24, 2022 @07:18AM (#31860139)
…and when you do need a large number of dynamically allocced/deallocced objects, then using indices to arrays instead of pointers. Which kinda defeats the purpose of using the Rust borrow checker…
Re:What it feels like when Rust saves your bacon by xyzzy123 on Friday June 24, 2022 @05:52AM (#31859631)
I think this mirrors my day to day experience with C++.

On the other hand, fuzzing large c++ programs will routinely uncover memory safety issues in practically any large codebase that hasn't been absolutely beaten to death by fuzzers already.

The issues are not usually so much "I returned this thing on the stack" they tend to be things like "this (very unexpected) sequence of api calls will result in a UAF in this deeply nested data structure over here on the heap".

Re:What it feels like when Rust saves your bacon by lmm on Friday June 24, 2022 @07:48AM (#31860373)
> The issues that Rust is supposed to help with are simply not what we spent time on. All the bugs reported are pretty much exclusively root caused to "business logic".

Everyone claims this, probably because business logic bugs are more memorable. But I've never seen it match the real statistics. According to the best published data, null alone is something like 30-70% of bugs, you just don't remember them because they're uninteresting.

Re:What it feels like when Rust saves your bacon by Macha on Friday June 24, 2022 @08:53AM (#31861007)
It depends on the person's mental categorisation of bugs too. For example I could see someone classifying null bugs as business logic bugs because "the business logic didn't account for that information not always being there"
Re:What it feels like when Rust saves your bacon by jhgb on Friday June 24, 2022 @10:35AM (#31862577)
It's a language bug, really. If you're expected to say what the individual things in your program are allowed to be (like you have to in C++, Java, C# etc.), and you say "foo is a BarBaz object", and the language and compiler allow you to set foo to something that isn't actually a BarBaz object and this is considered OK, then the language is botched.
Re:What it feels like when Rust saves your bacon by akhmatova on Saturday June 25, 2022 @07:34AM (#31874383)
There are and never will be (meaningful) statistics for the "N percent of bugs are caused by X" question.

Every org's use cases are different, how do you get (let alone compare) data frm different orgs, who really counts their bugs anyway (and those that do at scale and in detail are probably doing suffering from some form of myopic management disorder or another), etc.

All you can do is ask people their gut take based on their particular experience. For systems engineers, a lot of bugs are due to memory safety. For more consumer-oriented startups (or in most any bigcorp), yeah, it's "business logic" (or people's inability / unwillingness to communicate), etc.

"We found that 70 percent of our bugs could have been prevented by moving to TypeScript", yeah sure.

Re:What it feels like when Rust saves your bacon by capitainenemo on Friday June 24, 2022 @01:17PM (#31865996)
I wonder if passing NaN is considered "business logic" Thinking of this interesting exchange long ago by an experienced c++ dev

https://old.reddit.com/r/rust/comments/78bowa/hey_this_is_ky...

Re:What it feels like when Rust saves your bacon by mwcampbell on Friday June 24, 2022 @09:48AM (#31861751)
Counterpoint: When I was on the Windows accessibility team at Microsoft, one of my most brilliant colleagues gave a presentation about what to look for when doing code reviews, and he emphasized three main categories: C++, COM (Microsoft's Component Object Model), and concurrency. Rust eliminates many of the issues in the first and third categories. And yes, we were writing modern C++ as much as we could in that legacy codebase; by 2019 we were using several C++17 features, as well as the latest C++ utility libraries for working with COM and WinRT. Given the state of the Rust windows crate, that team (which both I and that colleague left in late 2020) might even be able to use Rust in new code. I'm sure that would make him happy.
Re:What it feels like when Rust saves your bacon by bestouff on Friday June 24, 2022 @05:40AM (#31859555)
My manager told me exactly the same thing as you do; after I found a few UB in its code in the first 2 weeks he changed its stance.
Re:What it feels like when Rust saves your bacon by josefx on Friday June 24, 2022 @06:12AM (#31859744)
I had to deal with a senior dev. that gave me a talk about seniority after I ran valgrind over our software. Guy was so deep into the whole senior dev. power trip that he blamed third party libraries for his bugs, dev. tools for "incorrectly" identifying his bugs and wrote more bugs to work around his other bugs.

Finding and fixing issues in C++ code can be easy with the available tools, getting people to use them on the other hand can can be like talking to a wall.

Re:What it feels like when Rust saves your bacon by darthrupert on Friday June 24, 2022 @06:22AM (#31859786)
That sounds more like an expert beginner than senior.
Re:What it feels like when Rust saves your bacon by im3w1l on Friday June 24, 2022 @09:25AM (#31861410)
Sounds like someone who senses his place in the hierarchy is threatened.
Re:What it feels like when Rust saves your bacon by staticassertion on Friday June 24, 2022 @05:52AM (#31859630)
Unsurprisingly the types of bugs reported are going to be around business logic errors and not obscure edge case that users won't run into naturally. The bugs are still there though.
Re:What it feels like when Rust saves your bacon by hgomersall on Friday June 24, 2022 @06:20AM (#31859775)
Right, and if you come across it you can't always reproduce it. "Oh it crashed, yeah it does that sometimes".
Re:What it feels like when Rust saves your bacon by nemothekid on Friday June 24, 2022 @10:26AM (#31862402)
>The issues that Rust is supposed to help with are simply not what we spent time on.

There could be plenty of bugs in your codebase but just because you don't spend time on them doesn't mean they don't exist. Hundreds of millions of people used OpenSSL everyday for 2 years after the Heartbleed bug was introduced. It didn't cause any obviously broken code until someone exploited it to read credit card numbers off of a remote server.

Re:What it feels like when Rust saves your bacon by ostenning on Friday June 24, 2022 @05:39AM (#31859548)
Can you elaborate on the proficiency of your dev team, is this with juniors etc? Is it a large team? And what is the complexity of the project? I think this is important information
Re:What it feels like when Rust saves your bacon by shuger on Friday June 24, 2022 @05:53AM (#31859641)
GPU driver, most devs are senior. Hundreds of thousands of lines of code in the "slice" my team is interested in. Team for our component has on it's own has probably over 40 people.

Driver should be even more prone to programming bugs because most of it is about manipulating data in raw "untyped" memory.

Re:What it feels like when Rust saves your bacon by the_mitsuhiko on Friday June 24, 2022 @08:12AM (#31860593)
GPU drivers are also some of the most buggiest stuff out there I used. When I worked in Games we routinely managed to make the GPU drivers crash which thankfully at the time was already no longer taking down your engine machine.
Re:What it feels like when Rust saves your bacon by Daishiman on Friday June 24, 2022 @04:18PM (#31868758)
My experience with GPU drivers then is that your code is likely buggy AF and your team is in denial.
Re:What it feels like when Rust saves your bacon by Agingcoder on Friday June 24, 2022 @10:49AM (#31862921)
In practice for you. Where I am, things are very different! Buffer overflows and memory corruptions, threading issues, uninitialized variables, etc appear on a very regular basis, and end up being very difficult to debug, mostly because the moment where you corrupt memory and the moment it triggers a bug can be very far apart.
Re:What it feels like when Rust saves your bacon by flohofwoe on Friday June 24, 2022 @09:08AM (#31861183)
Static analyzers can catch this stuff nowaways (in this case clang's builtin analyzer):

https://godbolt.org/z/1MfErrYd8

...in more simple cases it's also a regular warning:

https://godbolt.org/z/5v9YsWd4j

Re:What it feels like when Rust saves your bacon by kevincox on Friday June 24, 2022 @02:35PM (#31867331)
> less time debugging

I would say it isn't even the debugging. As many of the C++ programmers here have said as you get good at C++ this becomes something that you are vigilant for and it rarely actually gets written. But just the lack of even needing to think about it is a huge load off my mind. When I used to write C++ I never really realized how vigilant I was. Every time I added code into the middle of a function I had to double check all of the lifetimes, every time I shorted the lifetime of a variable I had to search for it to the end of the function. Just not having to worry about this much really frees your mind for thinking about other things.

Re:What it feels like when Rust saves your bacon by blub on Friday June 24, 2022 @02:45PM (#31867502)
And what are you thinking about now?

For me it was what lifetimes and types to use to make my program work. Just as it was in C++, but with a static verification step at the end which most of the time got in my way.

Rust makes lots of sense in high-churn projects or projects which have very high security requirements (like browsers). Otherwise I’d think carefully about using it.

Re:What it feels like when Rust saves your bacon by dralley on Saturday June 25, 2022 @09:59AM (#31875350)
You had to think about lifetimes in C++, too, but in Rust at least they're written down and enforced.
Re:What it feels like when Rust saves your bacon by blub on Friday June 24, 2022 @02:42PM (#31867445)
I find neither C++ nor Rust to be particularly “creative” programming languages because one has to think all the time about two things which are irrelevant for the features of the program - resource management and complicated types.

Rust is even worse than C++ because it highly encourages encoding logic in types and the community loves doing that.

You seem to have almost come to the same conclusion yourself, but then mistakenly assume that the same kind of productivity of a GC language is available in a system language. Nope. Although at least in C++ one can just say “fuck it” during the “creative” prototyping phase, copy most things and still have decent syntax and performance. In Rust you’d have to pepper everything with clone, boxes and (a)rc, so you'd have another mess.

Re:What it feels like when Rust saves your bacon by hinkley on Friday June 24, 2022 @03:53PM (#31868453)
The exhausting part for me was always when the bug escapes detection for a little while, is associated with some new functionality that very much did not escape detection, and it turns out that the wrong implementation is faster than possible. Now to fix the bug I get to be the bad guy and take away the customers toys (one of many many reasons to push for making the culprit fix the problem, especially if they don't want to).

It doesn't take many of these to form a coping mechanism that prevents this from happening again, even if it's at great cost. This is also the genesis of many unwinnable arguments that drag on forever.

Re:What it feels like when Rust saves your bacon by phendrenad2 on Friday June 24, 2022 @05:38PM (#31869703)
Nope. In my experience, Rust saves you from very common obvious errors that junior programmers make, certainly not 10x programmers who have been writing C for a long time. It's great when you're starting out (which is why it's massively popular with new graduates or people who are just learning to program), but at some point it's questionable if the hand-holding Rust gives you is worth the extra development time overhead, more complex syntax, etc.

It also depends on what you're writing. If you're writing cryptographic routines, or protocol handshaking, the tradeoffs are heavily weighted in Rust's favor.

Re:What it feels like when Rust saves your bacon by hardex on Tuesday June 28, 2022 @09:50AM (#31907648)
For the unironic use of "10x programmer", I'm hereby sentencing you to death.
Re:What it feels like when Rust saves your bacon by ttfkam on Saturday June 25, 2022 @11:03AM (#31875854)
Yep, all those kernel, driver, and database devs out there are all junior devs just starting out. No way anyone with decades of experience will introduce a remote exploit or crashing bug in their C programs and libraries. Never happens. No CVEs to see here! Move along!

/s

Re:What it feels like when Rust saves your bacon by phendrenad2 on Saturday June 25, 2022 @03:19PM (#31877926)
Why do you think this is a valid argument? Are you saying there are no junior devs working on databases, kernels, drivers? What evidence do you propose to back up that astounding claim?