CppCon 2018: Nicolai Josuttis “The Nightmare of Initialization in C++”

Channel:CppCon · Length:59:57 · Published:2018-10-27 · Views:79201

Watch on YouTube

Summary

Nicolai Josuttis's CppCon 2018 talk walks through the many forms of initialization in C++, including uniform initialization, and how their rules and effects differ. He argues the situation is confusing enough that nobody can say what to teach beginners.

Why HN recommends it

Used mostly as a citation of C++'s historical baggage and complexity when HN criticizes or jokes about the language.

Programming language design · C, C++, Rust, Go & systems languages

Subtitles (excerpt)

- My name is Nicolai Josuttis and I wanna talk a little bit about C++. You might have heard my name; I have written a couple of books, and I'm involved into C standardization since the first standard, so for more than 20 years now. So it's all my fault. (audience chuckles) When we talk about C++, I have problem. I'm not the smartest guy, that's why I write books, so I have a book where I can find out details, and C++ gets more and more complicated. This is a story about why and how things sometimes go worse when we think they go better, and how we should deal with that. So, this is a talk about initialization. Initialization is a topic we had since the beginning. In fact, we had it even before the beginning of C++: we started with C because we are backwards-compatible with C, and we had initialization rules adopted from C. So, we adopted that, and thus an int that is declared on the stack has uninitialized value, and we had adopted the usual way to initialize an int is an equal sign, which is not an assignment operator. Well, the way when we have aggregates, or structures, or arrays, to initialize a value was using an equal sign and curly braces. So, we adopted these rules and we introduced classes, and classes got a new syntax,

On Hacker News

Several CPPCON talks in recent years have reinforced that for me as well. [VIDEO] , for example. Edit: I originally linked to the wrong video ( [LINK] ), which was a different talk by the same person. — db48x, 2021-09
Agreed. Just gonna drop this here: Nicolai Josuttis “The Nightmare of Initialization in C++” [0] [0] [VIDEO] — hackingthenews, 2020-09
I think this depends to some extent on the type of job you're going for, which might seem trite but a graphics role is going to be different from a systems programming role. I've been writing Java for a long time and tired after a while of the JVM "getting in the way", and the lack of bare-metal acceleration available. Eventually designing and working on zero-GC systems led me to wonder why we di… — michaelg7x, 2019-11
C++ has more historical baggage than any other mainstream language. Consider something as simple as initialization: [VIDEO] — kinjba11, 2019-09
C++ initialization is such a convoluted mess that CppCon was able to have an entire hour dedicated to "The Nightmare of Initialization in C++". [VIDEO] C++ has a rigorous standard. There is no rule that wasn't added for a reason. Nor are there lines of code with which you can specify which rule it must follow. The path to hell is paved with good intentions. Just because each step is logical and d… — forrestthewoods, 2019-01

Related videos