• snoweA
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    I’m definitely missing something here. I’m terrible at rust and c++

    • RustySharp
      link
      fedilink
      English
      arrow-up
      19
      ·
      1 year ago

      The meme refers to the old adage “C lets you shoot yourself on the foot. C++ lets you shoot both feet and gives you a shotgun to do it” - referring to the how C allows you to perform memory-unsafe operations (causing corruption, or worse, security vulnerabilities), and C++'s complexity, potentially obscuring such unsafetyness.

      Rust’s memory safety tries to save you from doing (un)intentional bad stuff, by giving you compile-time errors. It’s also the bane of everyone so used to C/++'s ability to just pass around and modify whatever memory they want.

    • o11c
      link
      fedilink
      English
      arrow-up
      9
      arrow-down
      2
      ·
      1 year ago

      What you are missing, of course, is the Rc<Refcell<T>> that you have to stick everywhere to make a nontrivial Rust program. It’s like monads in Haskell, parentheses in lisp, verbosity in Java, or warnings in C - they’re the magic words you have to incant correctly to make things work in their weird paradigms.

      • lavafroth
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 year ago

        Or an Arc<Mutex<T>> if dealing with threads.