Re: The Case for Rust (in any system)

From: David Chisnall <theraven_at_freebsd.org>
Date: Mon, 09 Sep 2024 07:59:58 UTC
On 9 Sep 2024, at 08:39, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote:
> 
> But do you agree that the C++ compiler's take on things make more sense
> than the C compiler's in these cases ?

I’m not sure I’ve seen many places where it makes a difference. To me, most of the benefit of C++ comes from the ability to create types that enforce invariants. For example, in snmalloc we avoid using bare void* in most places and instead use a wrapper type that enforces the allocation state machine, so invalid transitions fail to compile. Just using C-style code with void* would not catch any of these bugs in C or C++ mode.

David