CppCon 2015: Herb Sutter 'Writing Good C++14... By Default'

preview_player
Показать описание

--
Modern C++ is clean, safe, and fast. It continues to deliver better and simpler features than were previously available. How can we help most C++ programmers get the improved features by default, so that our code is better by upgrading to take full advantage of modern C++?

This talk continues from Bjarne Stroustrup’s Monday keynote to describe how the open C++ core guidelines project is the cornerstone of a broader effort to promote modern C++. Using the same cross-platform effort Stroustrup described, this talk shows how to enable programmers write production-quality C++ code that is, among other benefits, type-safe and memory-safe by default – free of most classes of type errors, bounds errors, and leak/dangling errors – and still exemplary, efficient, and fully modern C++.

Background reading: Bjarne Stroustrup’s 2005 “SELL” paper, “A rationale for semantically enhanced library languages," is important background for this talk.
--

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

You know that something is amazing when it seems so natural and obvious that in hindsight you wonder why something like it wasn't done a decade earlier!

amaarquadri
Автор

Herb explains things so much better than Bjarne. Everything is nice and clear, even for a beginner like me. Thanks Herb! :-)

JCStelu
Автор

Thanks CppCon for share this videos early on! Look the number of views in few hours! Please continue posting other talks for all of us that unfortunately can't assist this great event with the C++ family. CppCon you're rock!!!

MrSparc
Автор

Fantastic presentation!

Amazing work, getting memory safety without too much annotation is fantastic.

Aleh_Loup
Автор

[Completing previous comment] As Herb said : "You take a copy of a shared pointer before you turn it into a raw pointer and pass it on a call tree". His point is that the tools he is presenting helps you to remember to do that.

mathieusoum
Автор

2:00, I know this is just a silly example. But it's nice to point some things. I use to separate the midia (big data) of a circle, from "its logic", which is likely to fit on caches. So it becomes an "OO inspired by DOD" approach.
As for for range loop, despite being a C++11 thing, I only passed to use it from C++14. It was required to specify the type. So on those years I used a macro of my own, which deduced the type, at the cost of using pointer syntax. I think "auto all the things" is gold.
3:31, good, because there are old things with bad reputation, that actually are pretty useful - macro, old enum, someone could say unions. So, don't make mistakes Carbon folks are already doing!

MrAbrazildo
Автор

+Vasiliy Galkin I think it's because gsp is a global variable so f() or any other fuction f() may call can access gsp directly and modify it (f.e. call gsp.reset()), so gsp' could be invalid.

Using sp means you increase the ref count so even if f() or any function f() calls modifies gsp, the ref count won't go down to 0 and delete the pointer's object.

It confused me too because Herb wasn't clear about the fact that gsp can be accessed and modified from the functions, even tho he said that (was thinking about what can change the pointer and not the owner).

enhex
Автор

The one thing about this newer style of C++ that I really hate is the keyword "auto". I always find it harder to figure out what's going on without the types being laid out explicitly.

ChefSalad
Автор

I am not an expert (at all), but I think the second method works because you create a copy of the smart point global_sp into the local sp. This should increment the number of existing references (pointers) to *global_sp (that's what smart pointers are for). With such a copy, it is now impossible for f() to completely invalidate global_sp using only sp.get() because there will be at least 1 more reference to *global_sp due to the copy before the call. Youtube response comments are too short ><.

mathieusoum
Автор

-1 because:
Visual Studio is free tool if you are open source developer. Look at Community edition.
Herb Sutter works for Microsoft so, yeah, he is firstly implementing everything for Visual Studio I guess and than it comes to clang or gcc.
And at last but not least as Zarviroff Serge said - it doesn't matter - it's about C++ and you not IDE or operating system.

CdTCzech
Автор

Does a crossword-puzzle or scrabble board use a 2-dimensional string?

jeffdovalovsky
Автор

Awesome presentation, very educational.. Thanks for sharing...

maxxmayhem
Автор

It kinda disturbs me that Herb pronounces things like "shared_ptr" as "shared putter" rather than "shared pointer"

VileLasagna
Автор

Lots of points for correctly using the term "dangling pointer". Too many otherwise good sources seem to confuse the meaning.

jvsnyc
Автор

I love this video so much.Really appreciated.

kimicochiang
Автор

I wonder if these static analysis tools work when the memory validations happen separated in the code. For example if a function created a pointer to that vector... Oh forget it, since I started writing this he started to cover this point. :D

Orgyilkos
Автор

reinterpret_cast is OK if you're interfacing with a C-style library (like OpenGL for example)? I use them there.

robbie_
Автор

Why old programmers were so smart :
1. Working with unsafe language
2. No Social Media
3. No CS all of them were mathematician.
So …

__hannibaalbarca__
Автор

I've written it wrong, f(global_sp) should be replaced by f(global_sp.get()), and f(sp) --> f(sp.get()).
Yet, my question remains open.

VasiliyGalkin
Автор

I don't really know C++. How can I learn how to do it how he mentions it @ 2:00 without having to go through the code on the left hand side.? In other words, learn C++14 from C [or scratch], not from C++03. I come from a C background as implied. I'd like to develop good habits from day one!

ecinZtark
join shbcf.ru