4 pointsby ingve6 hours ago1 comment
  • eimrine6 hours ago
    Memory safety is a GC. Rust has a compile-time GC, interpreted languages have a run-time GC.
    • whytevuhuni5 minutes ago
      Not quite, because depending on the compiler implementation / memory model, other things can also lead to UB, and thus be unsafe, e.g.:

      * data races in a multi-threaded program

      * type-casting to the wrong type (e.g. via unions) with compiler optimizations that rely on proper types

      * assuming values are absolutely never aliased (shared xor mutable) when there's actually a way to create aliased values (e.g. unsafe {} and raw pointers)

      * creating objects out of a sequence of bytes that is not valid for their type

      ...and likely many others I can't remember.