C++23 - What's In It For You? - Marc Gregoire - CppCon 2022

Поділитися
Вставка
  • Опубліковано 2 жов 2024
  • cppcon.org/
    ---
    C++23 - What's In It For You? - Marc Gregoire - CppCon 2022
    github.com/Cpp...
    C++23, the next release of the C++ standard, is scheduled to be released in 2023. The update introduces new features to the core language and to the Standard Library. If you want to stay up to date with the latest features that are upcoming with this new release, then this session is for you.
    The session includes core language topics such as consteval if statements, multidimensional subscript operators, decay copy, unreachable code, and more. New Standard Library features that will be shown include monadic operations for std::optional, std::flat_map, std::flat_set, a stacktrace library, changes to the ranges library, improvements to std::format, std::expected, and many more.
    The session will include references to other sessions at CppCon, if applicable, for more deep-dive information on any particular topic.
    ---
    Marc Gregoire
    MARC GREGOIRE is a software project manager and software architect from Belgium. He graduated from the University of Leuven, Belgium, with a degree in "Burgerlijk ingenieur in de computer wetenschappen" (equivalent to a master of science in engineering in computer science). The year after, he received an advanced master’s degree in artificial intelligence, cum laude, at the same university. After his studies, Marc started working for a software consultancy company called Ordina Belgium. As a consultant, he worked for Siemens and Nokia Siemens Networks on critical 2G and 3G software running on Solaris for telecom operators. This required working in international teams stretching from South America and the United States to Europe, the Middle East, Africa, and Asia. Now, Marc is a software architect at Nikon Metrology (www.nikonmetrology.com), a division of Nikon and a leading provider of precision optical instruments, X-ray machines, and metrology solutions for X-ray, CT, and 3-D geometric inspection.
    His main expertise is C/C++, specifically Microsoft VC++ and the MFC framework. He has experience in developing C++ programs running 24/7 on Windows and Linux platforms: for example, KNX/EIB home automation software. In addition to C/C++, Marc also likes C#.
    Since April 2007, he has received the annual Microsoft MVP (Most Valuable Professional) award for his Visual C++ expertise.
    Marc is the founder of the Belgian C++ Users Group (www.becpp.org), author of “Professional C++” 2nd, 3rd, 4th, and 5th Editions (Wiley/Wrox), co-author of “C++ Standard Library Quick Reference” 1st and 2nd editions (Apress), a technical editor for numerous books for several publishers, and a regular speaker at the CppCon C++ conference. He maintains a blog at www.nuonsoft.com/blog/ and is passionate about traveling and gastronomic restaurants.
    __
    Videos Filmed & Edited by Bash Films: www.BashFilms.com
    UA-cam Channel Managed by Digital Medium Ltd events.digital...
    #cppcon #programming #cpp

КОМЕНТАРІ • 68

  • @perfectionbox
    @perfectionbox Рік тому +23

    I have an uneasy feeling that C++ is evolving to solve problems it introduced earlier, and just spiraling in complexity as a result. I'm actually amazed anyone can develop a compiler for it now.

    • @origamibulldoser1618
      @origamibulldoser1618 Рік тому +4

      You and many many others. I tried reading effective c++14 and just gave up. This language cannot be mastered by anyone not dedicated full time to the language itself as opposed to solving problems with the language.
      See also Zig author's stated goal (paraphrased) "debug your program, not your knowledge of the programming language"

    • @rinket7779
      @rinket7779 10 місяців тому +1

      It's not that hard. Full time c++ programmer for 6 years. I love it

    • @videofountain
      @videofountain 8 місяців тому

      Often compilers do have mistakes. Not every discussion above requires a compiler change. Libraries evolve. Teams write and verify compilers. Yes this information must be catalogued at internet web sites. Stroustrup , Josuttis and others share some of your thoughts. You need not, and wont soon be able to use all features.

  • @russCoding
    @russCoding Рік тому +4

    Thank you Marc for this enlightening and informative explanation of all the new features. I find it very helpful to see a demonstration of what the methods may have been used prior to having the new feature being introduced, and with direct comparison to how you would use the new feature to accomplish a certain goal.

  • @kostikvl
    @kostikvl Рік тому +19

    Timeline for this talk:
    00:00 Intro
    ---- Core language ----
    01:56 Deducing this
    05:20 If consteval
    07:50 Multidimensional subscript
    08:37 Attributes on lambda expressions
    09:58 Literal suffix for size_t
    11:14 auto(x) decay-copy
    12:25 New preprocessor directives
    12:52 std::unreachable and assumptions
    15:25 Unicode assigned names
    16:27 Trim whitespace
    ---- Standard library ----
    17:40 std::print and friends
    19:36 import std / std.compat
    20:28 flat_map and flat_set
    22:28 mdspan
    24:00 std::generator
    25:09 std::string improvements
    28:56 Improvements around std::optional
    31:35 stacktrace
    32:38 New features for std ranges
    36:15 New features for std views
    44:07 std::expected
    45:55 std::move_only_function
    47:22 spanstream
    48:23 byteswap
    49:01 to_underlying
    50:02 Associative constainers improvements
    ---- Removed features ----
    51:39 garbage collection support
    ---- That's it ----
    52:09 Q & A

  • @1aggin_5amurai
    @1aggin_5amurai Рік тому +24

    Marc Gregoire is the best C++ author I've ever read (sorry Bjarne). He's just brilliant. Rarely I wasn't able to follow his thoughts flow and had to re-read sentence or block. His talent is surely in explaining complex things in simple manner. Latest edition of Professional C++, that covers also 20, did a great job on preparing me for interviews. Never before I was called C++ expert, and it's not only because all the interesting things and emphasizes Marc underlined and I memorized, but also because his vision on the language, and programming overall, changed my way of thinking.

    • @marcgregoire
      @marcgregoire Рік тому +10

      I'm happy to hear you like my work 🙂

    • @michaelobi8357
      @michaelobi8357 Рік тому

      It reflects in his book….best c++ book (imo)

    • @michaelobi8357
      @michaelobi8357 Рік тому

      It reflects in his book….best c++ book (imo)

    • @viorel1852
      @viorel1852 Рік тому +1

      I agree, i looked around at various author's work but Marc's is by far my favorite. I've actually smiled so many times when reading his work because i can actually understand it super easily. I have Pro. C++ 4th edition and am buying the 5th edition as well soon. thank you Marc for your work.

    • @budiardjo6610
      @budiardjo6610 7 місяців тому

      i am seeing bjarne conf talk and he always said simplified version of c++

  • @vectoralphaSec
    @vectoralphaSec Рік тому +10

    This new modern C++ is so different than the 1990's C++ i once learned. The language seems to have changed so much.

    • @cyanmargh
      @cyanmargh Рік тому +10

      Now C++ becomes different language every 3 years.

    • @douggale5962
      @douggale5962 8 місяців тому

      C++11 was the good one. The rest are crap.

  • @tedlyngmo9180
    @tedlyngmo9180 Рік тому +12

    I liked this very much. It had a list - and went through it in about an hour. I still got enough hints. Thanks!

    • @CppCon
      @CppCon  Рік тому +2

      Very pleased to hear from you that this presentation was helpful.

  • @mx2000
    @mx2000 Рік тому +4

    I can’t offer any C++ insights like Marc does, but I can offer a PowerPoint tip: to jump to a slide, enter the slide number and press enter.

  • @JaapVersteegh
    @JaapVersteegh Рік тому +4

    Bjarne stated something like he feels there is smaller language hiding inside C++ that is struggling to get out. I hope that struggle is going somewhere, because C++ is just getting bigger and bigger and more incomprehensible because of it.

    • @EgorDmitrenkov
      @EgorDmitrenkov 11 місяців тому +1

      C++29 document will be like 4k pages, then it crumbles

    • @gregandark8571
      @gregandark8571 8 місяців тому

      @@EgorDmitrenkov Is this a joke or really?

  • @mcmaddie
    @mcmaddie Рік тому +2

    2:14 I was listening this video on a background and I had to stop what I was doing and check video again because I thought he said 'overlords'. I was wondering what a overlords in C++ but turns out they are overloads.

  • @DFPercush
    @DFPercush Рік тому +2

    I heard something about C++23 making it easier for us to define our own ranges and use the pipe operator | on our own custom ranges. Any word on that?

  • @kryksyh
    @kryksyh Рік тому +8

    Still, I can't decide what do I hate/love more, the ugliness and the never-stopping growth of the complexity of the new language and STD features or the neatness of the high-level libraries that can be built on top on them

    • @ben1996123
      @ben1996123 Рік тому +1

      if that's the part that you like then just use rust instead. a lot of the standard library features covered in this video are just basic rust features that everyone uses all the time, except the c++23 ones are extremely ugly and verbose. for example that code at 38:15 in rust is just v.windows(2).map(|a| a[0] * a[1])

    • @BenjaminBuch
      @BenjaminBuch Рік тому +1

      I'm quite sure Rust will become the same backwards comparability problems within the next 10-15 years. Judging by the age of C++, I think the language is doing better than all the others.
      Rust is well worth a look, though, even if I see it more as a competitor to C than to C++.

  • @Bolpat
    @Bolpat Рік тому +2

    With deducing this, you can also bind the object by copy. This wasn't possible before at all.

  • @thegod3500
    @thegod3500 Рік тому +6

    Where is the networking library ? Are you killing me ?

    • @treyquattro
      @treyquattro Рік тому +2

      wait until C++29... (Maybe.) Networking is a massive, non-standard undertaking, just like graphics. Your library probably includes sockets and higher protocols are available on github. Yes, it'd be nice to incorporate at least all the standard low-level Internet protocols into the standard library (do you include SNMP, SMTP, interior & exterior gateway protocols, etc. etc.), but as you can see with HTTP (/S, 1.1, 2, 3/QUIC), the standards move too fast to incorporate them into the standard library, not to say anything about implementation details regarding blocking, thread models, co-routines, cryptography, and so forth. (Did you also want Netbios? IPX/SPX? SDLC? AppleTalk? etc. etc. etc.)

    • @marcgregoire
      @marcgregoire Рік тому +3

      It's not yet in C++23.

    • @JaapVersteegh
      @JaapVersteegh Рік тому +1

      @@treyquattro Typical C++ approach to want to do everything everywhere. If only one could just do a simple tcp connection using the standard library that would cover 95% of use cases... If that's not enough for you: use asio. I don't understand why that would be hard.

    • @douggale5962
      @douggale5962 8 місяців тому

      It is impossible because the "correct" way to do asynchronous operations is completely different on each platform. It will never happen. Nobody will use "a simple connection" in a million years. It has to be completely async because only a complete idiot does blocking network I/O.

  • @bayern1806
    @bayern1806 8 місяців тому

    Ok, I am at 8:30 and none of this I would ever use. I stopped watching, wont waste my time, just look at the overview slide, WTF is wrong with you guys? 🤣How can the narrator have such a serious face, does he really believe in what he is saying?

  • @shawarmagames1689
    @shawarmagames1689 7 місяців тому

    What this simple language has become. A GIAGANTIC MONSTER. Not at all beginner friendly. Some keywords are made for very very specific scenarios. I am sorry but I'd like to stick with C++ 14 or 17. Nothing more than that. Ranges are implemented poorly. Modules are partially done.

  • @origamibulldoser1618
    @origamibulldoser1618 Рік тому +1

    Herb. Save us. Cpp2 pls.

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

    @marcgregoire Marc, you are one of the best authors whom I follow for C++ and also you still seem quite young compared to the OGs(Bjarne, Scott and Herb) 😀

  • @ABaumstumpf
    @ABaumstumpf Рік тому +3

    That was a nice overview of the "nice" features in C++23.
    "unreachable" really should have been an attribute.
    std::generator is really helpful to making the c++20 coroutines not completely useless (they are so complex and so much boilerplate )
    "if consteval" sadly seems like a clutch for the rather unintuitive and broken behavirou of "constexpr" and "is_constant_evaluated".
    std::stack_trace - oh boy, that one is just... it would be great, if not for the fact that it does not really need to do what the used expects it to do. It does not need to give you an actual full stacktrace, it can contain several frames that are not in your code. You can have a stacktrace that starts with 3 or 4 EMPTY frames, NO entry for main, and only a function that is called 2-3 function-calls deep.

    • @leoalmeida2583
      @leoalmeida2583 Рік тому

      About stack_trace doesn't -fno-omit-framepointer solve that issue?

    • @Ch40zz
      @Ch40zz Рік тому

      The C++ standard has absolutely nothing to do with the underlying ABI the OS uses.
      Unwinding the stack is OS dependant and doesnt have anything to do with the language, if the OS cant unwind a frame then the language cant change much about it.
      Stuff can get inlined, frame pointers can be omitted, leaf functions might not be in callstack for obvious ABI reasons. This is native code and not some interpreted code.

  • @victotronics
    @victotronics 5 місяців тому

    That "deducing this" syntax is just weird. Eh, Jason Turner (episode 326) returns "auto&", not "auto&&". Both legal?

  • @hstrauss2214
    @hstrauss2214 Рік тому +1

    On the slide for ranges::fold_left() (about 35:30), what is the second parameter (1) in the fold_left example? If it is the initial value, why is the result 110 and not 111?

    • @BenjaminBuch
      @BenjaminBuch Рік тому

      It is the initial value, 111 is correct, the comment is probably a bug ;-)

  • @treyquattro
    @treyquattro Рік тому +1

    nicely explained. I'm quite looking forward to import std and import std.compat

  • @ctrl-alt-tutor5587
    @ctrl-alt-tutor5587 6 місяців тому

    "this auto self" ... Jesus - the standards' committee need to take a serious look at themselves...

  • @farenrai576
    @farenrai576 Рік тому

    why c++ is installation is very defficulty here are there installation required is there standard skd file to stall and update new features easily

  • @rinket7779
    @rinket7779 10 місяців тому

    What is he asking about around 53:30 ? I cant understand a word

  • @PeterPan-fb2ys
    @PeterPan-fb2ys Рік тому +2

    All these extensions make totally sense. And still there are a lot of pople overwhelmed by even slight changes and telling us what they are don't like. They didn't even understand why these features are needed. Still they have a strong opinion and throwing their biased aggressive nonsense at us. Stop whining and get at least some basic understanding before commenting. And your vague feelings are not really of interest to anyone. Yes it's a shame that we are still have no networking and full unicode support. But that doesn't mean that nothing has improved and that these new features are bad. I started with c++98 and the language has evolved so much since than. Many shortcommings are gone and a lot of workarounds are no longer necessary. The code has become clearer, more expressive, shorter and saver. Especially metaprogramming feels no longer like a heck.

    • @bayern1806
      @bayern1806 8 місяців тому

      Yeah explain to me why I need the features, and how I could survive all the years without them? You are the one who does not understand c++, thats why you need a solution for every "problem", because everything is a problem for you. New features contradict the coding guidelines of every company I worked for, there is a readability issue with all so called "features". And by the way, C++20 modules are still not supported by most popular compilers, thats why nobody is even using c++ 20 🤣

  • @pinokiopinokio4335
    @pinokiopinokio4335 Рік тому

    Hallo,I have a question.If you can do somethiing aboute "jumping from row to row" and if you do somethiing aboute "jumping from function to function",I think this could be perfect.

  • @VickyGYT
    @VickyGYT Рік тому +3

    thanks for making c++ uglier by every new standard....

  • @douggale5962
    @douggale5962 8 місяців тому

    It is pronounced "two-pull"

  • @CharlesHogg
    @CharlesHogg Рік тому +1

    53:27 the question cuts out, as do the autogenerated subtitles, for the "meat" of the question. What exactly are we only a stone's throw away from?

  • @ripley_hicks_newt_86
    @ripley_hicks_newt_86 Рік тому

    Interesting. I stopped using C++ almost 20 years ago. Which book would you recommend for a fresh restart with C++20 or even C++23?

    • @khatdubell
      @khatdubell Рік тому

      There isn't one that i'm aware of.
      The closest would be "more effective modern c++", but that only covers 14 i think.

    • @joachimjoyaux179
      @joachimjoyaux179 Рік тому

      - Modern C++ Programming Cookbook: Master C++ core language and standard library features, with over 100 recipes, updated to C++20, 2nd Edition
      - C++ High Performance: Master the art of optimizing the functioning of your C++ code, 2nd Edition

    • @57d
      @57d Рік тому

      I can vouch for Marc's book 'Professional C++' 5th ed., who happens to be the speaker in this video - super easy and informative reading.

  • @euankirkhope5390
    @euankirkhope5390 Рік тому +4

    such a bloated over extended language. shame.

  • @Ali-ng5pc
    @Ali-ng5pc Рік тому +3

    i cant see the standard networking library and standard package manager and standard build system, the essential needs, in cpp 23 list that u show at 1:35, disappointing......

    • @marcgregoire
      @marcgregoire Рік тому +6

      All those things you mentioned are indeed not yet in C++23.

    • @WutipongWongsakuldej
      @WutipongWongsakuldej Рік тому +2

      I don’t see why I want any of those though.

  • @VFPn96kQT
    @VFPn96kQT Рік тому

    Why "contains" doesn't return optional ? If we already have to find the value, why do we throw it away?

    • @krisz1911
      @krisz1911 Рік тому +1

      If you want to find the value, just use "find".

  • @openroomxyz
    @openroomxyz Рік тому

    What about C flavored C++ ?

  • @ZelenoJabko
    @ZelenoJabko Рік тому +2

    I swear to god, you guys sabotage your own language on purpose in order for Rust to win.

    • @BenjaminBuch
      @BenjaminBuch Рік тому +3

      Let's talk about that in 15 years when Rust has been aged and must handle backward comparability problems ;-)
      Rust is a great language, no doubt, but also C++ is still there and it's still evolving.