C++ Weekly - Ep 434 - GCC's Amazing NEW (2024) -Wnrvo

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ย. 2024

ความคิดเห็น • 35

  • @piotrbatko172
    @piotrbatko172 3 หลายเดือนก่อน +20

    Woudn't be cool to have [[rvo]] attribute for functions? It could report error if compiler is not able to do it.

    • @keris3920
      @keris3920 3 หลายเดือนก่อน +6

      I have had a lot of discussions about this exact idea lately. I want one for tail calls as well

    • @majohime
      @majohime 2 หลายเดือนก่อน

      Cool to have more control over rvo warnings, but absolutely horrible as more stuff to put in function declaration

  • @Raspredval1337
    @Raspredval1337 3 หลายเดือนก่อน +5

    this would've been useful to me like a week before. Had to pull one of your older videos about std::optional\std::variant and RVO to get it 'right'

  • @skeleton_craftGaming
    @skeleton_craftGaming 3 หลายเดือนก่อน +40

    C++ under the sea being in the Netherlands made me laugh...

    • @minirop
      @minirop 3 หลายเดือนก่อน +1

      On brand marketing

    • @ohwow2074
      @ohwow2074 3 หลายเดือนก่อน +2

      Netherlands going under the sea in 20 years?!

    • @TheDoubleBee
      @TheDoubleBee 3 หลายเดือนก่อน +5

      It's even funnier that, phonetically, C sounds like "sea", so it's sea++, which is not exactly what you want if you're already under the sea

    • @BaardFigur
      @BaardFigur 3 หลายเดือนก่อน +11

      ​@@ohwow2074 It's already below sea level today. That's the joke

    • @X_Baron
      @X_Baron 3 หลายเดือนก่อน +4

      I also love the name of the online conference Pure Virtual C++.

  • @austinbachurski7906
    @austinbachurski7906 3 หลายเดือนก่อน

    Awesome!

  • @PaulMetalhero
    @PaulMetalhero 3 หลายเดือนก่อน +4

    "MSVC compilers down" ... who cares?

    • @keris3920
      @keris3920 3 หลายเดือนก่อน +17

      I care

    • @MattGodbolt
      @MattGodbolt 3 หลายเดือนก่อน +5

      They're back now, either way

    • @keris3920
      @keris3920 3 หลายเดือนก่อน +2

      @@MattGodbolt Thank you for the amazing tool!

    • @MattGodbolt
      @MattGodbolt 3 หลายเดือนก่อน

      @@keris3920 You're welcome, honestly the main thing I do these days is admin and devops; I have a team of volunteers who do all the actual work :)

  • @jamesburgess9101
    @jamesburgess9101 3 หลายเดือนก่อน +3

    maybe C++ is getting simpler after all!

  • @nmmm2000
    @nmmm2000 3 หลายเดือนก่อน +8

    is this included in -Wall or -Wpedantic ?

    • @cppweekly
      @cppweekly  2 หลายเดือนก่อน

      Nope

  • @stevesimpson5994
    @stevesimpson5994 2 หลายเดือนก่อน +1

    Can you mix RVO and NRVO?

  • @anon_y_mousse
    @anon_y_mousse 3 หลายเดือนก่อน

    It is kind of annoying if the compiler can't correctly optimize away "temporaries" though. In my compiler I didn't even leave that kind of logic until the optimization stage and instead added it in as a basic part of compilation.

  • @cubeman5303
    @cubeman5303 3 หลายเดือนก่อน

    Great addition, tho I feel like as attribute it wouldn't get in the way as much as when it is global warning.

  • @KhalilEstell
    @KhalilEstell 3 หลายเดือนก่อน

    This is super neat Great video Jason!

  • @richardblain4783
    @richardblain4783 3 หลายเดือนก่อน

    6:44 Why would you ever need to rely on NRVO, other than for efficiency? The only situation I can think of is if you’re trying to return a non-copyable, non-movable object from a function. But in that case, the compiler could not return the object and you’d get an error diagnostic, with or without a -Wnrvo compiler option.

    • @garyesser1007
      @garyesser1007 3 หลายเดือนก่อน

      exactly as you said, for efficiency

    • @tommasobonvicini7114
      @tommasobonvicini7114 วันที่ผ่านมา

      Why would you ever need a job, other than for money? The only situation I can think of is if you're a psychopath that needs to blend in society without being noticed.

  • @kimhyunpil
    @kimhyunpil 3 หลายเดือนก่อน

    Thank you 👍👍

  • @X_Baron
    @X_Baron 3 หลายเดือนก่อน +2

    If you actually don't want elision, you can disable the warning by wrapping the return value in std::move (when the returned type has a suitable constructor). The intent may not be obvious to the reader, though...

  • @literallynull
    @literallynull 3 หลายเดือนก่อน +3

    I still prefer MinGW and Clang over MSVC for a reason...

    • @TrueWodzu
      @TrueWodzu 3 หลายเดือนก่อน

      How this is relevant to the video? He is using GCC :)

    • @literallynull
      @literallynull 2 หลายเดือนก่อน

      ​@@TrueWodzuMinGW is a GCC port for Windows

    • @TrueWodzu
      @TrueWodzu 2 หลายเดือนก่อน

      @@literallynull thanks!

  • @zergeyn
    @zergeyn 3 หลายเดือนก่อน

    Feels like C++ getting worse and worse. Now it's not ok to move objects out of a functions Yay :(

    • @simonmaracine4721
      @simonmaracine4721 3 หลายเดือนก่อน +8

      It has never been okay to move objects out of functions.
      C++ is not getting worse, but quite the opposite.