News for hackers. Stuff that matters.
Re:We still chose C++ (instead of Rust) for new database dev... by f311a on Monday September 29, 2025 @09:21AM (#45413436)
One thing I like about Rust is that it prevents you from doing stupid things on the compiler level. I write a little bit of C/C++ and Rust. If you don't do C++ on a daily basis, you will silently introduce problems in the code that are very hard to spot. You just need to have a very good mental model of how to write good C++. It requires constant exercising.

For Rust, you just have to fight the compiler. This is especially useful when you have people on your team with some experience who also want to contribute, but you don't want to constantly point them in the right direction.

I actually have no idea how big teams work on large C++ codebases. Usually, you need to have a good idea of how the whole thing works. You can change one part of the code, and it will introduce bugs in the whole project because of how the memory is handled. Isolated changes are hard. And historically, a lot of C++ codebases lack good test coverage.

Re:We still chose C++ (instead of Rust) for new database dev... by dataflow on Monday September 29, 2025 @09:33AM (#45413568)
> If you don't do C++ on a daily basis, you will silently introduce problems

Even if you do, you still will. Just less often.

> I actually have no idea how big teams work on large C++ codebases... You can change one part of the code, and it will introduce bugs in the whole project because of how the memory is handled

Part of it is lots of tests, sanitizers, assertions, etc.

Part of it is keeping things modular and avoiding spooky action at a distance to the extent possible.

Part of it is unavoidable, and that's why people are moving to safer languages.

Re:We still chose C++ (instead of Rust) for new database dev... by unshavedyak on Monday September 29, 2025 @10:02AM (#45413962)
Your post reminds me of the old runtime vs compile time language debates of old (for me). Some would argue duck typing is all that we need, and that lots of tests can cover the missing types/etc. Eventually i realized that i'm just manually implementing compile time typing by way of robust tests to cover interface requirements.
Re:We still chose C++ (instead of Rust) for new database dev... by sdeframond on Monday September 29, 2025 @10:08AM (#45414020)
> Eventually i realized that i'm just manually implementing compile time typing by way of robust tests to cover interface requirements

This, so much this!

Re:We still chose C++ (instead of Rust) for new database dev... by dataflow on Monday September 29, 2025 @12:34PM (#45415752)
Note that duck-typing can still be a compile-time thing: it's basically what you'd get in C++ if you use auto and templates for everything.

The trade-off between compile-time and run-time checking depends in large part on the time needed to address the issue. It's not really black and white. People just don't want to wait forever for static verification - I think that's kind of why clang-static-analyzer isn't used as much as clang-tidy.

Re:We still chose C++ (instead of Rust) for new database dev... by jmull on Monday September 29, 2025 @09:58AM (#45413915)
> I actually have no idea how big teams work on large C++ codebases.

They choose a memory management strategy and stick to it. Of course, the problem, relative to something like rust, is the compiler doesn't enforce it. You can use linting tools and/or reviews.

> Usually, you need to have a good idea of how the whole thing works. You can change one part of the code, and it will introduce bugs in the whole project

That's not a problem with C++ specifically. That's a problem with organization. It's probably best know as the "Big Ball of Mud" architecture[1]. Rust has no particular defense against it, nor other languages that I am familiar with. If you don't see it as much with rust it's only because it takes time to develop. (counter-intuitively, it's an impressively successful architecture -- so many long-lived projects use it).

[1] http://www.laputan.org/mud/

Re:We still chose C++ (instead of Rust) for new database dev... by on_the_train on Monday September 29, 2025 @12:02PM (#45415418)
> You can change one part of the code, and it will introduce bugs in the whole project because of how the memory is handled

Why would it do that?

Re:We still chose C++ (instead of Rust) for new database dev... by keanb on Monday September 29, 2025 @12:37PM (#45415786)
I suppose because it will start writing in memory that is handled by other parts of the code and corrupting it.
Re:We still chose C++ (instead of Rust) for new database dev... by on_the_train on Tuesday September 30, 2025 @11:33PM (#45434010)
That is an incredibly general statement at best. And reeks a bit of ancient c++ style. This bug would be pretty exotic and nothing I have ever seen in my life.
Re:We still chose C++ (instead of Rust) for new database dev... by cmrdporcupine on Monday September 29, 2025 @09:32AM (#45413562)
Honestly after 6 months to a year of constant Rust development you don't even fight with the compiler anymore. Instead it's mostly just your friend.

There are still logical holes in the borrow checker, but they're mostly irrelevant.

Re:We still chose C++ (instead of Rust) for new database dev... by wavemode on Monday September 29, 2025 @02:18PM (#45417005)
> I actually have no idea how big teams work on large C++ codebases

Well yeah, you don't. Most people who comment on these sorts of threads don't, which obviously colors their bias in favor of the solution they do understand.