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

Поделиться
HTML-код
  • Опубликовано: 23 июн 2024
  • ☟☟ Awesome T-Shirts! Sponsors! Books! ☟☟
    Upcoming Workshop: Understanding Object Lifetime, C++ On Sea, July 2, 2024
    ► cpponsea.uk/2024/sessions/und...
    Upcoming Workshop: C++ Best Practices, NDC TechTown, Sept 9-10, 2024
    ► ndctechtown.com/workshops/c-b...
    Upcoming Workshop: Applied constexpr: The Power of Compile-Time Resources, C++ Under The Sea, October 10, 2024
    ► cppunderthesea.nl/workshops/
    CLion is a cross-platform JetBrains IDE for C and C++ with:
    - A smart C and C++ editor to navigate and maintain your code base productively.
    - Code analysis with quick-fixes to identify and fix bugs and style inconsistencies.
    - An integrated debugger - along with other essential tools from the ecosystem - available
    straight out of the box.
    - And much more!
    jb.gg/clion_ide code: CppWeeklyCLion
    Episode details: github.com/lefticus/cpp_weekl...
    T-SHIRTS AVAILABLE!
    ► The best C++ T-Shirts anywhere! my-store-d16a2f.creator-sprin...
    WANT MORE JASON?
    ► My Training Classes: emptycrate.com/training.html
    ► Follow me on twitter: / lefticus
    SUPPORT THE CHANNEL
    ► Patreon: / lefticus
    ► Github Sponsors: github.com/sponsors/lefticus
    ► Paypal Donation: www.paypal.com/donate/?hosted...
    GET INVOLVED
    ► Video Idea List: github.com/lefticus/cpp_weekl...
    JASON'S BOOKS
    ► C++23 Best Practices
    Leanpub Ebook: leanpub.com/cpp23_best_practi...
    ► C++ Best Practices
    Amazon Paperback: amzn.to/3wpAU3Z
    Leanpub Ebook: leanpub.com/cppbestpractices
    JASON'S PUZZLE BOOKS
    ► Object Lifetime Puzzlers Book 1
    Amazon Paperback: amzn.to/3g6Ervj
    Leanpub Ebook: leanpub.com/objectlifetimepuz...
    ► Object Lifetime Puzzlers Book 2
    Amazon Paperback: amzn.to/3whdUDU
    Leanpub Ebook: leanpub.com/objectlifetimepuz...
    ► Object Lifetime Puzzlers Book 3
    Leanpub Ebook: leanpub.com/objectlifetimepuz...
    ► Copy and Reference Puzzlers Book 1
    Amazon Paperback: amzn.to/3g7ZVb9
    Leanpub Ebook: leanpub.com/copyandreferencep...
    ► Copy and Reference Puzzlers Book 2
    Amazon Paperback: amzn.to/3X1LOIx
    Leanpub Ebook: leanpub.com/copyandreferencep...
    ► Copy and Reference Puzzlers Book 3
    Leanpub Ebook: leanpub.com/copyandreferencep...
    ► OpCode Puzzlers Book 1
    Amazon Paperback: amzn.to/3KCNJg6
    Leanpub Ebook: leanpub.com/opcodepuzzlers_book1
    RECOMMENDED BOOKS
    ► Bjarne Stroustrup's A Tour of C++ (now with C++20/23!): amzn.to/3X4Wypr
    AWESOME PROJECTS
    ► The C++ Starter Project - Gets you started with Best Practices Quickly - github.com/cpp-best-practices...
    ► C++ Best Practices Forkable Coding Standards - github.com/cpp-best-practices...
    O'Reilly VIDEOS
    ► Inheritance and Polymorphism in C++ - www.oreilly.com/library/view/...
    ► Learning C++ Best Practices - www.oreilly.com/library/view/...
  • НаукаНаука

Комментарии • 29

  • @skeleton_craftGaming
    @skeleton_craftGaming 6 дней назад +35

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

    • @minirop
      @minirop 6 дней назад +1

      On brand marketing

    • @ohwow2074
      @ohwow2074 6 дней назад +2

      Netherlands going under the sea in 20 years?!

    • @TheDoubleBee
      @TheDoubleBee 6 дней назад +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 6 дней назад +11

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

    • @X_Baron
      @X_Baron 6 дней назад +4

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

  • @piotrbatko172
    @piotrbatko172 6 дней назад +14

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

    • @keris3920
      @keris3920 6 дней назад +4

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

  • @user-cy1rm5vb7i
    @user-cy1rm5vb7i 6 дней назад +4

    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'

  • @nmmm2000
    @nmmm2000 6 дней назад +8

    is this included in -Wall or -Wpedantic ?

  • @austinbachurski7906
    @austinbachurski7906 6 дней назад

    Awesome!

  • @kimhyunpil
    @kimhyunpil 6 дней назад

    Thank you 👍👍

  • @KhalilEstell
    @KhalilEstell 6 дней назад

    This is super neat Great video Jason!

  • @jamesburgess9101
    @jamesburgess9101 6 дней назад +2

    maybe C++ is getting simpler after all!

  • @X_Baron
    @X_Baron 6 дней назад +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...

  • @richardblain4783
    @richardblain4783 6 дней назад

    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 5 дней назад

      exactly as you said, for efficiency

  • @cubeman5303
    @cubeman5303 6 дней назад

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

  • @anon_y_mousse
    @anon_y_mousse 4 дня назад

    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.

  • @literallynull
    @literallynull 6 дней назад +3

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

    • @TrueWodzu
      @TrueWodzu 2 дня назад

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

  • @PaulMetalhero
    @PaulMetalhero 6 дней назад +2

    "MSVC compilers down" ... who cares?

    • @keris3920
      @keris3920 6 дней назад +14

      I care

    • @MattGodbolt
      @MattGodbolt 4 дня назад +2

      They're back now, either way

    • @keris3920
      @keris3920 4 дня назад +1

      @@MattGodbolt Thank you for the amazing tool!

    • @MattGodbolt
      @MattGodbolt 4 дня назад

      @@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 :)

  • @zergeyn
    @zergeyn 6 дней назад

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

    • @simonmaracine4721
      @simonmaracine4721 6 дней назад +4

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