• ssm@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    3 months ago

    If there was a simpler way to make C memory-safe, it would have been done decades ago.

    We’ve had compile time sanitizers (-fsanitize=blah in gcc/clang) and runtime sanitizers (valgrind) for ages. I don’t know how they stack up against rust’s compile time sanitizers, but it’s something.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      3 months ago

      About how an Excel spreadsheet with no formulas stacks up against a corporate accounting suite. Valgrind is how you find the bleeding once you inevitably introduce a memory bug. I don’t understand all the fsanitize options, but I’m guessing they aren’t a blanket solution, exactly because memory bugs have still been inevitable.

      This thread is making me wonder how many people actually understand what Rust does. It rigorously prevents any form of memory error at all in normal code, and unsafe blocks, where needed, tend to be tiny. It makes C segmentation faults look just as goofy as JavaScript type errors.