CppCon 2014: Herb Sutter 'Back to the Basics! Essentials of Modern C++ Style'

preview_player
Показать описание
--
--
This talk revisits basic questions, such as how to declare and initialize a variable, how to pass a value to a function, how to write a simple loop, and how to use smart pointers, in the light of experience with C++11 and the latest C++14 refinements. This involves examining auto, rvalue references, range-for loops, uniform initialization, lambda expressions, unique_ptr and shared_ptr, and more.
--
Herb Sutter - Author, chair of the ISO C++ committee, software architect at Microsoft.
--

*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

Whether or not you agree with what he says, nobody can disagree that this guy is a brilliant public speaker.

dandymcgee
Автор

A passionate, humble, learned man giving an engaging talk. This feels like reading K&R felt. Such clarity and simplicity in that which seemed so complicated when learning it in other contexts.

arisweedler
Автор

Note: 47:30 (auto x = type{init}) making a temporary+move: this has been fixed in C++17 by copy elision. Type does not even have to be moveable.

Xeverous
Автор

Brilliant work that still feels relevant 8 years later.

re: auto type deduction - I think my fear of it comes from ending up with std header compilation errors later in the maintenance cycle. Working with C++ and watching videos like this one is making me smarter all the time, but I think I'm maybe just not quite smart enough yet. But this definitely convinces me to try using it more.

re: C++ developers care a lot about performance - Well, the only time it really makes sense to use C++ is if performance is a higher priority than time to market.

shavais
Автор

I feel like the people who are still saying (even today) that cppcon is just an echo chamber of experts talking to each other, with little of value for an average developer might have had a point at some time in the past, but that certainly by the point of this talk it was not true. There have been countless great Back-To-The-Basics talks and others that show that they are very actively trying to increase the circle of C++ competency, and are not at all obsessed with hyper-expertise that could only be understood by a group of people that fits in an auditorium, much less an elevator. Great stuff.

jvsnyc
Автор

I agree with the philosophy here. The day I gave up on typing perfectly optimal code is the day I became 100x more productive

wesofx
Автор

It drives me crazy that so many of this video shows Herb instead of his code!

MindControlMethod
Автор

Herb is by far my favorite speaker from these conferences

hackerish
Автор

Chandler and Herb are my favorites! Many thanks guys!

aggin_amurai
Автор

the content is great but the cut's are horrible, there are so many times the slides would be helpful but only the speaker is visable

ben
Автор

This is extremely useful, especially the parameter passing.

siwenzhang
Автор

1:33:00 You can do it with structured binding in C++17:
_std::set< int > digits = { 1, 2, 3, 5, 6, 7, 8, 9, 0 }; // missed 4_
_for( int i = 0; i < 10; ++i )_
_{_
_auto const& [it, result] = digits.insert( i );_
_if( result )_
_{_
_std::cout << "Inserted: " << *it << std::endl;_
_}_
_}_

aggin_amurai
Автор

This is the hardest "Back to the Basics!" talk that I ever watch.

kamilziemian
Автор

It is 2022 and this presentation is still extraordinary and the speaker is fenomenal!
By far the best c++ presentation I have ever attended!

simeyabate
Автор

It's ironic how Herb come into realization C++ defaults are beyond repair and begun cppfront initiative in 2016.

doBobro
Автор

41:10 been thinking about this for a while. Nice to see it being covered here

NSSMutableYoutubeChannel
Автор

"C++ is evolving man, we're going faster."
2

QuentinUK
Автор

When it comes to option 4 for set_name, Herb, the confident guy in the audience and the guy expressing his surprise about its performance advantage in the end curiously all messed it up at some point.
Herb firstly messed it up, because compilation of the code on his slide will fail as soon as used with a string argument because of the exclamation mark. Without it, compilation will still fail as soon as used with a char* argument, as during his benchmark. Herb is simply wrong with his "Write it right", instead do not constrain the template unless the function is overloaded.
So the confident guy in the audience is right saying Herb constrained the template wrong. But it is even more wrong than he apparently expected. Because of the erroneous exclamation mark, the function will indeed accept a string literal.
Finally the guy expressing his surprise about the performance advantage of option 4 appears to have a valid point at first sight because without the exclamation mark the template should generate at compile time the exact code of option two. But it only does so if used with a string argument. A char* argument causes compilation to fail as mentioned before. If the entire constraint had been correctly left out, then there would be no reason for surprise either because the generation of a char* template instantiation enabling the usage of string::operator=(const char*) clearly accounts for the performance advantage.
Despite Herb's attempts to shift responsibility onto Howard, I think, Howard is the only one involved who has got everything right. He was dealing with an overloaded function in a different context like a constructor overloaded with copy and move constructors. His function being overloaded with a function taking some type X, in order to prevent the forwarding reference from matching X too, he had to write an template constraint to exclude X from the template, hence the exclamation mark. Herb just blindly copied Herb's code from a different context, fiddled with the data types according to his faulty understanding of the purpose of the constraint, and ended up with something which is wrong for multiple reasons.

prednaz
Автор

why is the camera mostly on him rather than the slides?

MercedeX
Автор

If we're no longer encouraged to pass-by-value on setter functions, does this mean we should also discourage copy-and-swap assignment operators, which suffer from the same problems?

SoftNFuzzy