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/... - Наука та технологія
Thanks God it’s not another April fools video 😊
I was hoping this ridiculous amount of complexity was a joke.
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 😅
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!
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
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"?
Debugger must be always the last resort. Right before you bring out the logic analyzer.
@@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
@@yephick Because "I thought it would be easy and I could just read the code and fix it real quick"
@@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
When you wanted to switch from the С++14 at least to С++17 😢
The minus sign has three different purposes.
Number sign
Unary negation
Binary subtraction
sooo how would you evaluate 4---2 ? 🙃
You could parse it as 4-(-(-2))). Thats what seems most intuitive to me.
@@roh_son You mean 4---2 is an invalid arithmetic expression?
@@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.
@@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.