C++ Weekly - Ep 422 - Moving from C++20 to C++23

Поділитися
Вставка
  • Опубліковано 31 бер 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...
    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/...
  • Наука та технологія

КОМЕНТАРІ • 16

  • @alskidan
    @alskidan 2 місяці тому +3

    Thanks God it’s not another April fools video 😊

    • @bobweiram6321
      @bobweiram6321 2 місяці тому +4

      I was hoping this ridiculous amount of complexity was a joke.

  • @gracicot42
    @gracicot42 2 місяці тому +3

    6:10 I think using the [[noreturn]] attribute can be used to convince the compiler it either always throw or abort.
    EDIT: Oh, I watched the rest of the video. Seems like it works 😅

  • @Minty_Meeo
    @Minty_Meeo 2 місяці тому +4

    3:31 I never knew C++20 concepts could be used to constrain the type deduction of auto declarations like that. That's really neat!

    • @CyberDork34
      @CyberDork34 2 місяці тому

      I always forget that auto is basically just templates, so anything you can do in a template you should be able to do with auto

  • @yephick
    @yephick 2 місяці тому +7

    8:59 - Soo... why do you struggle for THAT long before doing the right thing and firing up a debugger to figure out "what's wrong"?

    • @GeorgeTsiros
      @GeorgeTsiros 2 місяці тому +4

      Debugger must be always the last resort. Right before you bring out the logic analyzer.

    • @yephick
      @yephick 2 місяці тому +6

      @@GeorgeTsiros quite the opposite is true. Unless you know pretty much right away what is wrong you SHOULD first try a debugger to step through the code, instead of doing debugger's job(!) manually, which is what Jason was doing there with code navigation and mental up-keep of the program's state at various branch junctions

    • @cppweekly
      @cppweekly  Місяць тому +1

      @@yephick Because "I thought it would be easy and I could just read the code and fix it real quick"

    • @yephick
      @yephick Місяць тому

      @@cppweekly thanks for the honest reply. And yeah, I'm guilty of doing that myself, of course. Still thought it is worth pointing out to bring to light the "right tool for the job" moto

  • @quarkdoe4380
    @quarkdoe4380 2 місяці тому +1

    When you wanted to switch from the С++14 at least to С++17 😢

  • @GeorgeTsiros
    @GeorgeTsiros 2 місяці тому

    The minus sign has three different purposes.
    Number sign
    Unary negation
    Binary subtraction
    sooo how would you evaluate 4---2 ? 🙃

    • @adriancruz2822
      @adriancruz2822 Місяць тому +1

      You could parse it as 4-(-(-2))). Thats what seems most intuitive to me.

    • @GeorgeTsiros
      @GeorgeTsiros Місяць тому

      @@roh_son You mean 4---2 is an invalid arithmetic expression?

    • @michael.galassi
      @michael.galassi Місяць тому

      @@GeorgeTsiros I think so, -- has higher precedence than - so this should be the same as (4 - -)-2, or am I too sleep deprived to miss the obvious?
      error: lvalue required as decrement operand
      const auto x = 4---2;
      ^
      In a fixed font the '^' lines up under the first minus sign.

    • @GeorgeTsiros
      @GeorgeTsiros Місяць тому

      @@michael.galassi The point is, C language expressions are not _arithmetic_ expressions. 4---2 is a valid _arithmetic_ expression, but an invalid expression in C. C does not accept arithmetic expressions.