CppCon 2014: Bjarne Stroustrup "Make Simple Tasks Simple!"

CppCon · 84K views · 2014 · 1:37:36

Open on YouTube

C, C++, Rust, Go & systems languagesProgramming language designSoftware practice, open source & careerstalk

Why Stack Overflow recommends it

Stack Overflow users link it when citing Stroustrup's own examples and philosophy, for instance his use of auto with braced initializers or his advice to keep solutions simple and avoid over-clever designs.

Recommended by 1 people across 1 different months, 2013 to 2015.

What it is

Bjarne Stroustrup's CppCon 2014 keynote on how modern C++ (C++11 and C++14) can make everyday programming tasks simpler without giving up performance. He walks through auto, range-for, move semantics, futures and concepts, with the emphasis on writing readable, maintainable code rather than clever pointer tricks.

What people said

Recommends Philipp Claßen · 2014-10 · Stack Overflow · on “Why is there a special type deduction rule for auto and braced initializers in C++11/C++14?”

In his CppCon 2014 talke "Type Deduction and Why You Care" [LINK] , Scott Meyers raises the question why there is a special rule about auto and braced initializers in the C++11/C++14 standard (his question starts at 36m05s [LINK] ). The semantic of auto in combination with a braced-init-list is defined in §7.1.6.4/6. I thought about it and could not come up with a use-case either. The closest thing that I have seen so far is one example where Bjarne Stroustrup used it. In his Cpp 2014 talk "Make Simple Tasks Simple!" [this video] , he once uses auto to capture initializers (but only as a workaround). Here is the code (part of slide 30, at 37m10s [this video] ): // auto ss1 = collect({ 1, 2, 3, 4, 5, 6

Cites Tomas Kubes · 2013-05 · Stack Overflow · on “Why implementing multiple interfaces with same property shows 'ambiguity' warning?”

The solution is to define a property Percentage again with new keyword like this: private interface IBase1 { int Percentage { get; set; } } private interface IBase2 { int Percentage { get; set; } } private interface IAllYourBase : IBase1, IBase2 { new int Percentage { get; set; } } private class AllYourBase : IAllYourBase { private int _percentage; public int Percentage { get { return _percentage; } set { _percentage = value; } } } private void Foo() { IAllYourBase iayb = new AllYourBase(); int percentage = iayb.Percentage; //OK } Notice: C# approach to interfaces is very different to approach plan by Bjarne StrouStrup in C++14 [this video] . In C# you have to claim, that the class implement inte

Cites 5gon12eder · 2015-01 · Stack Overflow · on “using abstract class as data type in constructor of dependent class”

Pointers and references can refer to abstract types. Inside your Compose class, you've declared the pointer members _f1 and _f2 which is fine. However, you cannot assign a reference to a pointer so you should change Compose 's constructor to also take pointers as arguments. class Compose : public Function { private: Function *_f1, *_f2; // these are pointers public: Compose(Function & f1, Function & f2) : _f1(f1), _f2(f2) { // ^^^ references here ^^^ ^^^ problem there ^^^ } // ... }; This would work: Compose(Function * f1_ptr, Function * f2_ptr) : _f1(f1_ptr), _f2(f2_ptr) { // ^^^ pointers here ^^^ ^^^ pointers there ^^^ } But using raw pointers like this is a problem. Who will be responsibl

Cites Tomas Kubes · 2015-09 · Stack Overflow · on “Call base member after virtual dispatching (emulate virtual destructor-like dispatching)”

It seems to me too complicated. What real problem do you try to solve? Do you really need be so smart? Let me paraphrase Bjarne Stroustrup. He said something like: "Make Simple Tasks Simple". If you create super smart solution, nobody else will understand it, not even you after some period, because understanding of someone's code is much harder then creating new code. [this video] If I take and show any of source codes provided in answers below to average C++ programmer and ask: "What is this code good for?", they will hardly come with satisfactory answer.