• schnurrito@discuss.tchncs.de
    link
    fedilink
    arrow-up
    28
    ·
    1 year ago

    “result” is fine. That is the variable you will end up returning that you have to fill with stuff first.

    “data” on the other hand…

    • Hal_Canary@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 year ago

      I came here to say this.

      Declare result in the first line of the function and return result is the last line. In C++, this is a big hint to the compiler that you want return value optimization to kick in.