• henfredemars@infosec.pub
    link
    fedilink
    English
    arrow-up
    10
    ·
    edit-2
    9 hours ago

    You can also make everything a smart pointer and be done with it.

    I can count on more than one hand the number of large scale projects where converting everything to smart pointers fixed major memory issues. Even if smart pointers can’t handle circular references, the number of projects that just don’t manage their memory correctly at all and were fixed by introducing these tools is way too high.

    • xmunk@sh.itjust.works
      link
      fedilink
      arrow-up
      3
      ·
      8 hours ago

      This is a bit embarrassing but the last time I actively worked in C++ it was with Qt and pre C++11.

      • henfredemars@infosec.pub
        link
        fedilink
        English
        arrow-up
        2
        ·
        8 hours ago

        Almost the same as me. All kinds of programming jobs. I usually end up working in Python or C, for embedded systems work.

        Of course, if you’re talking hobby, it could be anything.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      2
      ·
      10 hours ago

      Which kind of smart pointer, with which kind of footgun? I mean, it’s better than not even trying I guess, but if it was actually a full solution you’d just have Rust.

      • henfredemars@infosec.pub
        link
        fedilink
        English
        arrow-up
        6
        ·
        9 hours ago

        You’re right. It’s a stop gap, but when you’re talking about a code base that has been maintained for 20 years plus you can’t really sell re-implementation.

        Most recently it was with an older version of C++ using shared pointers.