• pewpew
    link
    fedilink
    121 year ago

    Whats the difference between void fn(Type& var) and void fn(Type* var)?

    • @[email protected]
      link
      fedilink
      51 year ago

      You can pass nullptr in the second example (that is not what OP wrote though, hes second is making a copy).

      • pewpew
        link
        fedilink
        21 year ago

        Thanks, I was Just curious. I knew what * did but I wasn’t sure about &

    • @[email protected]
      link
      fedilink
      61 year ago

      I guess you ask for C++. There Type* can be null while Type& can’t be null. When it gets compiled Type& is compiled (mostly) to the same machinecode as Type*.

    • @[email protected]
      link
      fedilink
      311 year ago

      Sends original data vs making a copy of data and sending it.

      In meme context you’d be just making a copy of your consciousness and putting it in a machine. Whatever reason you’re doing it for - escape illness, survive armageddon, nothing changes for you. A copy of you lives on though.

      • MaggiWuerze
        link
        fedilink
        91 year ago

        I mean, just kill the host as soon as the upload is complete. at best you are not conscious during the process and when “you” wake up you are in the cloud. The version of you that awakes gets told that the “transfer” was complete.