• xmunk@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    arrow-down
    5
    ·
    8 months ago

    Not really. Pointers are almost always a bad idea - just use const refs and you’ll be fine.

    • Sonotsugipaa@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      4
      ·
      8 months ago

      If using pointers is out of the question, then why choose to learn a language with explicit memory access before anything else?

      I have yet to learn Rust, but from what I hear it’s simpler and (mostly?) memory-safe – implying that it’s generally a better first language to learn.

      • xmunk@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        8 months ago

        Pointers are almost always a bad idea - but you’ll probably get a lot of mileage out of having a handful of them in a large project… there’s an impulse with new C++ devs to do everything with pointers and use complex pointer arithmetic to do weird array offset and abuse predictable layouts to access stack variables etc… pointers are fine when used with moderation.

    • Gabu@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      8 months ago

      What do you mean? Pointers are the best thing ever. It either works, or you manage to make fireworks!