How beautiful is a language where you can make a one hour long video on initialization?
@johnnycashcow113011 ай бұрын
There’s a whole book dedicated to initialization :-)
@ayushdey549410 ай бұрын
@@johnnycashcow1130 name Just curious
@matthijshebly10 ай бұрын
C++ "beautiful"? Lol
@milad691410 ай бұрын
what's the name?@@johnnycashcow1130
@BenjaminBuch9 ай бұрын
I really hope that C++ Syntax 2 will leave the experimental stage before 2030 and get first citizen support in the most important tools. I love C++, but something as elementary as initialisation shouldn't be so complicated. A few really dark places in relation to templates didn't even appear here.
@v-for-victory5 ай бұрын
🎯 Key points for quick navigation: 00:00 *🎓 Introduction to Initialization in C++* - Introduction to the session and the presenter, Ben Saks, - Overview of the complexity of initialization in C++, - Initial example showing different initializations depending on the type. 02:12 *📜 Historical Context and C Initialization Rules* - Explanation of C initialization rules for scalars and aggregates, - Copy initialization for structures and unions, - Zero initialization for static or thread-local storage duration objects. 06:10 *🚀 C++ Initialization Enhancements* - Introduction of class types and constructors in C++, - Differences in initialization rules due to class invariants, - Definition and restrictions of aggregates in C++03 and updates in C++20. 12:06 *⚙️ Direct vs Copy Initialization* - Direct initialization using constructors and member initializer lists, - Clarification on copy initialization using the equals sign, - Distinction between initialization and assignment. 18:08 *🏗️ Understanding Constructors and Copy Initialization* - Examples of initializing class objects and invoking constructors, - Handling class types with user-defined constructors, - Explanation of converting constructors and explicit constructors. 24:00 *🛠️ Default and Value Initialization* - Default initialization and the concept of vacuous initialization, - Parsing ambiguities and the most vexing parse issue, - Usage of empty parentheses in various contexts for value initialization. 30:00 *🔍 Deeper Dive into Value Initialization* - Behavior of value initialization based on the type T, - Value initialization for arrays and scalar objects, - Evolution of value initialization syntax from C++03 to C++17. 32:06 *🧩 Problems Addressed by Modern C++ Initialization* - Challenges with non-uniform initialization syntax, - Issues with narrowing conversions and complex value initialization, - Specific problems with initializing STL containers. 32:36 *💻 Challenges with Initialization in C++03* - Types and initialization forms: Scalars, aggregates, and class types with user-provided constructors, - Difficulty in knowing the right initialization form in templates, - Issues with silent narrowing conversions and initializing STL containers. 37:12 *🛠️ Modern C++ Initialization Improvements* - Introduction of brace initialization for uniform syntax, - Benefits like avoiding function parsing ambiguity and supporting value initialization, - Examples of using brace initialization with different types. 42:53 *🔍 Detailed Look at Direct and Copy List Initialization* - Explanation of direct list initialization and copy list initialization, - Differences in handling explicit constructors and narrowing conversions, - Examples illustrating when each form of initialization is used. 48:14 *🧩 Handling Narrowing Conversions and Initializer Lists* - Prohibiting narrowing conversions with brace initialization, - Using explicit casts to handle necessary narrowing conversions, - Creating and using initializer list constructors for flexibility in container initialization. 53:10 *🔄 Managing Constructors and Initializer Lists in Templates* - Impact of having multiple constructors, including initializer list constructors, in template classes, - Recommendations for carefully designing classes with initializer list constructors, - Example of potential confusion and best practices in handling initializer lists and template functions. 59:06 *📚 Best Practices and Template Initialization* - Using direct initialization in standard library functions like make_unique, - Handling aggregate initialization with C++20's improvements, - Conclusion with a summary of the evolution and benefits of modern C++ initialization rules.
@catsANDgamesLOVERS9 күн бұрын
Ty
@siddheshkalekar563211 ай бұрын
Great talk !! Thanks for the historical explanation of probably the most confusing topic
@kimicochiang11 ай бұрын
Thanks Ben! I really appreciated you and Dan gave me opportunity to get to know cpp more.😊
@trondenver501711 ай бұрын
Another Saks banger
@glory96052 ай бұрын
A very nice starting point to understand the Initialization dilemma
@xwize11 ай бұрын
Excellent talk
@supershaye11 ай бұрын
Perfect. I was just reading the C++ standard paper N1890 and N1919 to understand the initialisation story so this is a perfect recap!
@Evan490BC9 ай бұрын
Yes, the infamous C++ initialisation horror story.
@ПетрПроценкоАй бұрын
I am new to CPP and have to use it out of direness of my situation where I am forced for do Qt and Arduino Studio at the same time for my company lacks developers. Thank for pointing out this mother of all mistakes, with the function parameters and ignored superfluous parentheses. Not that I can say that now I understand initialization, but as a junior I am beginning to see the depth of my lack of knowledge on CPP.
@x87-64Ай бұрын
Amazing lecture. Initialization in C++ always seemed scary to me. This made me feel good
@aviralvikram94316 ай бұрын
Hello, you shared some greate knowledge with us here and i want to save it in my stash collection but i can't find the ppt for this presentation the github repo of cppcon. Does anyone have any idea where can i find it?
@ppb23742 ай бұрын
很好的演讲,让我了解到初始化为什么整得那么复杂。
@MyMjrox10 ай бұрын
I cannot find the slide for it in the link to the repository?
@placintaalexandru8556 ай бұрын
The more I look at C++ talks, the more I am grateful to Rust
@msmeraglia11 ай бұрын
lol this thumbnail looks like something out of a Tim & Eric sketch
@msmeraglia11 ай бұрын
kzbin.info/www/bejne/hWiun4iIh5yJrM0
@s0rr0wHacker11 ай бұрын
My team lead made me watch this, greetings to him
@sxxbxx21975 ай бұрын
The average programmer doesn't understand all the things that need to go on under the hood. All this stuff in C++ allows library writers to provide the under the hood stuff instead of it requiring everything to be provided by the core language teams.
@SEEJMAN8 ай бұрын
kzbin.info/www/bejne/lWOWoqCQqal1rsk At 44 minutes Ben states that "direct-list-initialization would permit conversions from const char* to demo_str". However clang 16 report an error. struct demo_str { explicit demo_str(const char*){} }; struct C { C(int, demo_str const&){} }; int main() { C c {1, "asdf"}; // error: no matching constructor for initialization of 'C' }
@MuharremGorkem11 ай бұрын
A question: Do you believe that C++ will ever save itself from C or even from itself to become a humanly programming language BEFORE LLMs will kill all programming languages including and hopefully starting from C++ ? By just watching this video alone you may easily see that complexity of initialization is comparable to whole instruction set of a CPU....So to save ourselves from writing assembly, we are supposed to write in C++ as a simplification?? How ironic.... Well, I admit that C++ would be perhaps a candidate for underlying-assembly language of LLMs in some near feature.
@marco2127411 ай бұрын
Do you believe that currently LLMs are good enough? Maybe for some mobile app but for something more important? Many of the Rust programmers I met were hard core C programmers before. The had some really emotional dislike for C++. I see C++ as a pragmatical language. It is a tool. Can we improve the tool? Definitely! Can there be other tools who fits some jobs better. Yes too. But will be there a silver bullet? My experience says no. There were many proposed silver bullets. They needed the hype to find their niche but they had drawbacks too. Now the newest hype ist Rust. Will it be better for some problems? Definitely. Will it fix C++ biggest problems. I highly doubt it. People love to speak about resource management. But actually it is not nearly the biggest problem I encounter. C++ has already quite good tools for that. Especially compared to C.
@ryleitdept11 ай бұрын
I still believe that direct machine code is hard and takes time to understand.LOLS
@AlfredoCorrea11 ай бұрын
I think static analysis is already saving C++ from C. They do what compiles can't do: breaking with residual C syntax and forcing (suggesting) one syntax over the 20 other alternatives from backward compatibility. but people have to voluntarily opt-in and set up build systems with this.
@Evan490BC9 ай бұрын
In a rare feat of proactive thinking the C++ committee designed the C++ programming language in a form that no LLM can generate it!
@tbkih9 ай бұрын
Please, please, next time look into the camera and say "it's free real estate"