On Sat, Feb 5, 2022 at 6:18 PM Derek Fawcus <dfawcus+lists-coff@employees.org> wrote:
On Fri, Feb 04, 2022 at 06:18:09PM -0500, Dan Cross wrote:
> [TUHS to Bcc, +COFF <coff@minnie.tuhs.org> ]
>
> This isn't exactly COFF material, but I don't know what list is more
> appropriate.
>

[snip]

> However, right now? I think it
> sits at a local maxima for systems languages targeting bare-metal.

Have you played with Zig?  I've only just started, but it does seem to
be trying to address a number of the issues with C ub, and safety,
while sticking closer to the 'C' space vs where I see Rust targetting
the 'C++' space.

It doesn't have Rust's ownership / borrow checker stuff, it does seem
to have bounds checking on arrays.

To be fair, I haven't given zig an honest shake yet. That said, the borrow checker and ownership are a major part of what makes Rust really useful: it dramatically reduces the burden of manual memory management. True, it also means that some of the things one would like to do are annoying (mutually self-referential data structures can be rough; self-referential structures similarly since a move is conceptually equivalent to memcpy).

My cursory scan says that Zig already has a lot over C for this space, though.

e.g. the UB for multiply example you give ends up as a run time panic
(which I suspect can be caught), or one can use a different (wrapping)
multiply operator similar to in Rust.

i.e. see the below test program and its output.

Nice.

        - Dan C.