you are viewing a single comment's thread
view the rest of the comments
[–] 4 points 3 months ago (2 children)

Zig is way better than C in many other respects, so if you want a modern sane language and you're either a Rust luddite or working on a project where memory safety isn't that important, it might be attractive.

Like, if the choice is C or Zig, then Zig is pretty much a no-brainer (or it will be when it hits 1.0). It just fixes so many insane things about C that have been broken for literal decades.

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 2 points 3 months ago (1 child)

    working on a project where memory safety isn’t that important

    I can't really imagine anything where this is not the case, unless you're doing like... I dunno, small scripts for personal use or something? But why would you use Zig or C or even Rust for that, just do Python or even bash at that point? Python is memory safe and perfectly suitable for very small programs where static analysis gives little benefit.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 3 months ago

    There are definitely some cases where memory safety isn't especially important:

    • Single player games
    • Apps that don't process external data (e.g. a simple calculator).
    • Lots of things running on microcontrollers, where the form of input could never possibly cause any security issues. E.g. a motor controller or a basic syringe pump or a (non-smart) washing machine or something.
    • Tests, e.g. I've considered writing RISC-V tests in Zig. They're traditionally written in C or assembly.

    In cases like those, memory unsafety mainly leads to non-security bugs and annoying debugging sessions. But I wouldn't say it's as much of a deal breaker compared to e.g. writing a video codec or font renderer or web browser or DNS server or whatever.

    I still think Rust is a better choice than Zig in most cases anyway, even ignoring memory safety. But in these cases it's at least a defensible choice.

  • source
  • parent