this post was submitted on 05 Aug 2024
964 points (97.5% liked)

Programmer Humor

19817 readers
33 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
964
Evolution of C (programming.dev)
submitted 4 months ago* (last edited 4 months ago) by [email protected] to c/[email protected]
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 4 months ago* (last edited 4 months ago) (1 children)

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.

[โ€“] [email protected] 1 points 4 months ago* (last edited 4 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.