Remix.run Logo
tcfhgj 6 hours ago

So riiR is now riiZ? ;)

nine_k 5 hours ago | parent [-]

"Rewrite it away from C (or C++)". Whether you choose Rust, Zig, Ada, D, Nim, even Pascal, it's likely going to become more secure. It will be supported on fewer platforms though, but still should run fine under Linux, macOS, Windows, *BSD, on x64, Arm64, and likely RISC-V, too.

maleldil 4 hours ago | parent [-]

Zig isn't memory safe, though. It's safer than C or C++, but not much.

ashikns 3 hours ago | parent | next [-]

This is what I have struggled to understand about Zig. It seems pretty much like C in a mental model aspect - you are responsible for everything. It's slightly better than C, but C already runs on everything on the planet and can be made secure even if painfully so. So what niche is Zig aiming to fill?

throwawaymaths 3 hours ago | parent | next [-]

no, null pointers are enforced safe at the type level in zig, as are array bounds, this eliminates huge classes of errors, so you are not "responsible for everything". unlike c, you often (unless highly tuned performance is needed) do not have to resort to opaque void pointers, and the compiler gives you typesafety on that, another major footgun in c.

also operators and integer types are unambiguous, and there is no UB in safe compilation modes.

It's arguably much better than C, not "slightly better than C"

uecker 18 minutes ago | parent | next [-]

If you write a modern style of C, you can have bounds checked code and do not need to use void pointers. I usually find that people overestimate the advantages of newer languages compared to using C by comparing to old and badly written C.

an hour ago | parent | prev [-]
[deleted]
barddoo 3 hours ago | parent | prev [-]

Zig detects memory leaks pretty well when you build it using -Doptimize=Debug.

throwawaymaths 3 hours ago | parent | prev [-]

checked array bounds is memory safety.