• porgamrer@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    To me it’s not really excitement so much as “oh god how do i make this ridiculous language do the correct thing”.

    I’m way more scared of rogue implicit copy constructors. I wonder if cppfront has any plan to fix problems like implicit copy and pessimising move.

  • QuadriLiteral@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I wonder if the language could be updated so these extra std::move invocations actually become harmless? return std::move is something that I see used quite a bit.

    • lysdexic@programming.devOPM
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      I wonder if the language could be updated so these extra std::move invocations actually become harmless? return std::move is something that I see used quite a bit.

      These std::move invocations are harmless, as they only cast objects to their rvalue reference.

      The destructive bit takes place in the type they are assigned to, as it invokes either a move constructor or a move assignment operator, and calling those implies that the object you just passed to std::move will be invalidated after the call and should not be used subsequently.