Тёмный

CppCon 2015: Bjarne Stroustrup “Writing Good C++14” 

CppCon
Подписаться 149 тыс.
Просмотров 342 тыс.
50% 1

www.cppcon.org
--
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/isocpp/CppCoreGuid...
--
How do we use C++14 to make our code better, rather than just different? How do we do so on a grand scale, rather than just for exceptional programmers? We need guidelines to help us progress from older styles, such as “C with Classes”, C, “pure OO”, etc. We need articulated rules to save us from each having to discover them for ourselves. Ideally, they should be machine-checkable, yet adjustable to serve specific needs.
In this talk, I describe a style of guidelines that can be deployed to help most C++ programmers. There could not be a single complete set of rules for everybody, but we are developing a set of rules for most C++ use. This core can be augmented with rules for specific application domains such as embedded systems and systems with stringent security requirements. The rules are prescriptive rather than merely sets of prohibitions, and about much more than code layout. I describe what the rules currently cover (e.g., interfaces, functions, resource management, and pointers). I describe tools and a few simple classes that can be used to support the guidelines.
The core guidelines and a guideline support library reference implementation will be open source projects freely available on all major platforms (initially, GCC, Clang, and Microsoft).
--
Videos Filmed & Edited by Bash Films: www.BashFilms.com
*-----*
Register Now For CppCon 2022: cppcon.org/registration/
*-----*

Опубликовано:

 

22 сен 2015

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 140   
@JCStelu
@JCStelu 8 лет назад
"- Doctor, doctor, it hurts when I hit myself in the head with the hammer! - So don't do it!" Thank you, Bjarne! :-))
@kamilziemian995
@kamilziemian995 Год назад
What to do when my hammer is C++?
@thesanctuary225
@thesanctuary225 5 лет назад
Thank you sir Dennis Ritchie. Thank you sir Bjarne Stroustrup. You totally changed history of mankind.
@enhex
@enhex 8 лет назад
"competing with C++ over the years has not been a winning strategy."
@kuchenzwiebel7147
@kuchenzwiebel7147 4 года назад
For the long term....
@TheLappin
@TheLappin 5 лет назад
I feel like Rust and C++ are trying to do the same thing, starting from opposite directions. Rust started out safe, C++ started out expressive and both languages tries to move towards being both expressive and safe. They both have their use cases. C++ integrates well with legacy code, is already well established and has much library support. Rust is still getting there, but it has come very far since this talk took place and I think it's now ready to be adopted for new projects. Great talk, by the way!
@BB-lf5zm
@BB-lf5zm 5 лет назад
Rust has a lot of static analysis to make sure the code is safe, but a little too much to be enjoyable
@TheLappin
@TheLappin 5 лет назад
@@BB-lf5zm It's possible to get used to it. Initially when learning Rust, you'd have to fight the borrow checker a lot and it might not be all that enjoyable (for me this period lasted for months), but after some practice it's not that bad at all. And the advantages of the static analysis is not to be understated, particularly as your project grows larger it can be incredibly helpful. There are so many memory related problems that I can immediately rule out when searching for the cause of a bug in my program. Never getting segmentation faults is pretty neat too.
@maxx666mayhem
@maxx666mayhem 8 лет назад
Awesome video by Bjarne as always.. Thanks for sharing...
@josephlagrange9531
@josephlagrange9531 Год назад
Dijkstra and Wirth spoke negatively about C++. Stroustrup lobbied C++ at that time. At fact I agree with some dudes claiming Stroustroup is far from good designer.
@NikolasDanielEngels
@NikolasDanielEngels 8 лет назад
Although all the restrions of C++, Bjarne and others always came with new ideas that respect the principles from the day one. Wonderful talk! C++ keeps going to be a better language for those who take programming as professionals...
@VoidloniXaarii
@VoidloniXaarii 9 месяцев назад
Here in 2023 didn't think this 2014 c++ talk was worth my time... but then gave it a random shot... either this guy has charisma +7 or this is amazing.. or both? His book being delivered tomorrow... excited...
@lodathi
@lodathi 8 лет назад
Amazing truths! I wish more young graduates thought this way.
@MikeDiack
@MikeDiack 8 лет назад
Again absolutely right SS. The avoidance of using new keywords and overloading the others etc. also makes it more difficult for compiler writers / static analysis tool developers - to develop and extend those tools as well.
@clodgozon3968
@clodgozon3968 5 лет назад
I clearly understand the topic. Good job, C++ Creator!
@LydellAaron
@LydellAaron 4 года назад
I like his mention at 11:20 for not allocating memory "malloc()" "new()" in reference to C/C++' use in flight critical systems. You want to do your non-deterministic memory allocations upfront or outside of deterministic real-time time-critical code sections.
@forgetfulfunctor1
@forgetfulfunctor1 2 года назад
I'm just asking cause I mightnt know the terms like how you're using them, but did you get deterministic and non- flipped?
@cgazzz
@cgazzz 4 года назад
1:14:00, I did this exact thing as it was a huge problem where half the codebase was const correct and half wasn't. After explaining to my boss why propagate_const is needed to deal with it he said const correctness didn't really matter as you can get around it with mutable. About the same time that I quit.
@philophile147
@philophile147 8 лет назад
This is actually a pretty clever place to do recruiting. Then again, hardcore cpp lovers have opportunities galore. I'd be interested in hearing about the magnitude of response you get!
@aeluned
@aeluned 8 лет назад
You just don't need most of that old style code for most tasks. And it's prone to human error. Give the compiler the intent you have and let it protect you from human error as much as possible. The old dark corners of C++ are so rarely needed. This is a such a powerful language and also a very stigmatized one because of that sort of thinking. Of course the old stuff will never go away, but let's be honest about how useful it is. Easy to learn, hard to master. That is a versatile language.
@BB-lf5zm
@BB-lf5zm 5 лет назад
For a normal desktop/enterprise applications, probably not, but if you get into gaming industry or applications requiring high performance, you will be surprised to find many dark side commonly. A simple pointer direct might damage the performance
@dudanov
@dudanov 5 лет назад
Thank you, Bjarne!
@prafulsrivastava8942
@prafulsrivastava8942 2 года назад
I wonder what I would have done without CppCon. Keep up the good work!
@CppCon
@CppCon 2 года назад
Thanks!
@fritzschnitzmueller3768
@fritzschnitzmueller3768 3 года назад
I love bjarnes random book covers(e.g. Mountains or birds for c++ books-its funny) and love that he choose a wind power plant as beginning slide for this presentation :
@desertshadow72
@desertshadow72 Год назад
I imagine his mind sees more beauty and complexity in the commonplace simple things so they are impressive to him.
@baltazarus3307
@baltazarus3307 4 года назад
Excellent presentation Mr. Stroustrup, I enjoyed.
@bjarnestronstrup9122
@bjarnestronstrup9122 4 года назад
Technically speaking it's Dr. Stroustrup.
@baltazarus3307
@baltazarus3307 4 года назад
@@bjarnestronstrup9122 xD true!
@MrTargetSan
@MrTargetSan 8 лет назад
mr. Stroustrup said many right things. There's only one problem I see with them. C++ is a language of "unsound defaults". So making your code "sound" will require tons of work. In C++, the price to make an error is almost zero, but to fix it isn't.
@aliancemd
@aliancemd 8 лет назад
Very good talk. I am really torn between Rust and Modern C++... C++ has evolved very nicely but sadly, where I work people are afraid of using a newer compiler and newer features(actually, not afraid, lazy to learn new stuff is more accurate). We are still using GCC 4.4... Can't even use sanitizers, what to say of C++11, 14 and 17...
@Exachad
@Exachad 6 лет назад
I'm gonna puke! GCC 4.4?
@BB-lf5zm
@BB-lf5zm 5 лет назад
Get out of there now
@QuentinUK
@QuentinUK 8 лет назад
GSL Guidelines Standard Library.
@DaveYostCom
@DaveYostCom 8 лет назад
54:59 With these guidelines you can get perfect resource safety and resource safety. The talk perhaps should have started here.
@annaoaulinovna
@annaoaulinovna 3 года назад
c++ is awesome this guy must take nobel prize of computer science
@MikeDiack
@MikeDiack 8 лет назад
Again, absolutely right. C++ must stop extending as a language. Many of us are not en fully au fait with all of C++11, never mind 14, 17 etc...
@ekimr90
@ekimr90 8 лет назад
Of course there's dislikes! It's because C++14 isn't Assembly.
@michal.gawron
@michal.gawron 8 лет назад
I think that it's good to have a good teacher of C++, so people won't be scared. Bjarne is a good teacher, IMHO. ;-)
@GeorgeTsiros
@GeorgeTsiros 5 лет назад
GARRETT turbo, i'm sold 🤘
@razterizer
@razterizer 8 лет назад
Bjarne rules.
@KananDethin
@KananDethin 7 лет назад
Thank you. Watched the whole video.
@adrienhamelin484
@adrienhamelin484 8 лет назад
That is exactly what he wants, to only teach the new stuff. Look at 1:27:40. The things like "owner" are only meant as low-level stuff for people that write containers and such, otherwise smart pointers remain the way to go (if you need ownership).
@Littlefighter1911
@Littlefighter1911 7 лет назад
34:32 I accidentally did this and it has NOT been caught be the compiler, neither MSVC nor GCC.
@kaboissonneault
@kaboissonneault 8 лет назад
One has to understand that it is not required to know the full language to use it. See the slide at around 3:00, don't get lost in details and if you don't like X, don't use it. Across the millions of C++ users, every small addition is probably going to help thousands of people. If it doesn't help you, ignore it
@atoshdustosh2762
@atoshdustosh2762 7 месяцев назад
Very useful concepts.
@vimleshkumarkanaujiya
@vimleshkumarkanaujiya 3 года назад
Legend behind Real Programming Language...
@antonpetrenko9176
@antonpetrenko9176 2 года назад
one of the best hydra fighter!=)
@MrTargetSan
@MrTargetSan 8 лет назад
It's not propaganda. Maybe a bit of trolling from my side, yes. I really enjoy that committee started some real improvements. I just feel they're a bit slow and late. Development model with core team on a reference compiler and a large contributing community already shows better results.
@SunggukLim
@SunggukLim 7 лет назад
he is good speaker
@andik70
@andik70 8 лет назад
anybody has some links to good c++(14) code? (not the guideline, just leading by example)
@siweiliao4557
@siweiliao4557 7 лет назад
facebook/folly
@deusbuda
@deusbuda 8 лет назад
muito bom...
@AbcDino843
@AbcDino843 4 года назад
26:15, umm, should that not be q->use()?
@KangJangkrik
@KangJangkrik 3 года назад
That's the point of the topic
@Trollkemada
@Trollkemada 8 лет назад
You should probably add the github link to the video description.
@JaihindhReddy
@JaihindhReddy 7 лет назад
Bjarne said there is a simpler, smaller, safer language in c++ struggling to get out. Is Google's Go an attempt to build that smaller, simpler and safer language from the ground up? Just how good is Go? Can someone point me in the right direction here? There just seem to be too many ways to do anything in c++?
@mousedresden604
@mousedresden604 8 лет назад
What is the URL for the materials he mentions in the talk?
@rock00dom
@rock00dom 8 лет назад
github.com/Microsoft/GSL github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
@VamoAComeLaPapa
@VamoAComeLaPapa 8 лет назад
This is not a language war, my friends!
@X152535
@X152535 7 лет назад
Has anybody reviewed the GCC compiler's source code recently to make sure the NSA didn't slip any other trojans in there?
@melvyniandrag
@melvyniandrag 7 лет назад
not yet lets do it
@gordongoodman8342
@gordongoodman8342 6 лет назад
Any other trojans? Are you implying it was done before?
@ProphetPX
@ProphetPX 6 лет назад
hahaha what do you think "Security Enhanced" Linux distros are??? LOLLL :)
@maximmarchal9991
@maximmarchal9991 3 года назад
11:40 wait why wouldn't they use new and delete after take-off?
@robfielding8566
@robfielding8566 8 лет назад
Indeed it's fast at runtime. But C++ is not efficient for verifying correctness, and is slow to compile. I love the idea of compilers subsetting C++ as part of the fix. not_null should be the default, undefined behavior should always be a compiler warning that needs an explicit annotation at that point in order to proceed.
@michaelmoser4537
@michaelmoser4537 8 лет назад
the GSL library is here github.com/Microsoft/GSL but so far i don't see the static analysis tool. Great that Mr. Stroustrup is working for a company where mortal programmers have real problems with pointer ;-) I wonder if C++ would have been a better language now if he did that ten years ago.
@raj8041
@raj8041 2 года назад
Hello sir, thank you so much for this lovely c++. Is it possible to write a singleton class using smart pointers, and that should be thread safe as well?
@kousoulides
@kousoulides 5 лет назад
writing good C++ 98 code writing good C++ 11 code writing good C++ 14 code writing good C++ 17 code writing good C++ 20 code writing good C++ Java code dude stop, you had me at C++98
@SatansSpatula
@SatansSpatula 8 лет назад
Bjarne says we need a language or guideline where you don't have to be a language lawyer to use C++. Then he proceeds to show slide after slide of poorly explained language lawyer nonsense. You've spent too many years obsessing on ownership semantics, clever use of iterators, and refusal to introduce new keywords, preferring to overload existing ones. I've spent more time re-learning C++ every few years than I would have spent simply transitioning into new languages.
@brotherhood_of_harkonnen
@brotherhood_of_harkonnen 2 года назад
24:52: resource management
@childhood1888
@childhood1888 2 года назад
One should not quote himself but it is a good quote.🙂
@aliveho2720
@aliveho2720 6 лет назад
I love c++;
@MrTargetSan
@MrTargetSan 8 лет назад
Dear mr. Stroustrup, if you want someone to use GSL, please at least move all what's not interface into separate INL file. Because parsing 2078 SLOC file to determine what's public and what's not isn't very pleasant.
@enhex
@enhex 8 лет назад
I have a different view on it. If there's something you don't like you probably don't understand what it's used for.
@user-mi8es4ur5w
@user-mi8es4ur5w 8 лет назад
Свершилось! Лед тронулся еще в 11, но 14 это уже будующее в настоящем.
@thesanctuary225
@thesanctuary225 5 лет назад
C is Wonderful Language. C++ is Wonderful too. It was really good idea that, when he create C++, didn't change C itself. (He presented good respect to his predecessor, Dennis.) Thus, we can enjoy C as well as C++ with same file format, cpp.
@MrTargetSan
@MrTargetSan 8 лет назад
Unless you try to debug code buried deep in something like Boost's MPL templates. You need to know language just to understand what others wrote.
@freshsheets_
@freshsheets_ 6 лет назад
So basically just don't use 'new' or 'delete'
@desertshadow72
@desertshadow72 Год назад
Talk really gets started around 7:00 ish
@TheBuzzSaw
@TheBuzzSaw 8 лет назад
I strongly disagree. C++11 and C++14 introduce infrastructure meant to replace much of how things were done in C++98. The old stuff will never go away, but it is BETTER and EASIER if a newbie starts out learning std::unique_ptr, range-based for-loops, etc.
@lexshardaduriz1036
@lexshardaduriz1036 5 лет назад
Conservative.
@thesanctuary225
@thesanctuary225 5 лет назад
C++ is not hard to learn if you aleady mastered C. So learn C first and master it. Than learn C++. Now it's much easier.
@willowFFMPEG
@willowFFMPEG 4 года назад
Can confirm
@moseswachira1165
@moseswachira1165 8 лет назад
congrant
@chaosmeist3r
@chaosmeist3r 8 лет назад
already fixed in the repository
@enhex
@enhex 8 лет назад
57:27 Is that Gabe Newell?
@Illasera
@Illasera 7 лет назад
Writing good C++ code, you don't, And never forget, "Avoing using linked list because, bad" - Bjarne Stroustrup
@chaosmeist3r
@chaosmeist3r 8 лет назад
26:00 "q" is a pointer, but instead of using the "->" operator for pointers, he uses the "." operator :/
@viacheslav1392
@viacheslav1392 Год назад
of course there is a macro man #define . ->
@Jiskov
@Jiskov 8 лет назад
Why not both? Rust is an amazing leap forward in language tech, but there's no need to throw away what you know. The concepts in both Rust and modern C++ compliment each other, and both languages can easily coexist. Plus, Rust is getting big enough that it doesn't even need to poach mindshare from C++ anymore.
@amirishere
@amirishere 8 лет назад
Every time you say "it's painful", I want to say "I feel your pain".
@todorsamardzhiev144
@todorsamardzhiev144 8 месяцев назад
3:10 oof, based
@SatansSpatula
@SatansSpatula 8 лет назад
Furthermore, I've got, what, four or more pointer wrappers, but I still don't have a decent string utility class that supports practical Unicode processing and useful member functions. No string::ToUpper, I still have to cobble something together with std::algorithm and bizarre char_traits members. C++ just isn't worth the effort. Put that energy into improving your architecture and algorithm selection in a better language.
@ledues3336
@ledues3336 7 лет назад
What about std::string s = "This has lowercase characters"; { int i = 0; while (s) { s[i] = toupper(s[i]); i++; } } // ps: there exists a tolower function too.
@ledues3336
@ledues3336 7 лет назад
oops I meant ++i
@vladimirsadovnikov3797
@vladimirsadovnikov3797 6 лет назад
And you'll get overhead of double-checking index parameter when calling both operator [] statements on each iteration. Nice performance!
@SrIgort
@SrIgort 4 года назад
std::transform(beg, end, std::toupper)
@MikeDiack
@MikeDiack 8 лет назад
Absolutely right SS. C++ has just turned into a mess.
@stupid_sleazoid2
@stupid_sleazoid2 7 лет назад
0:13 guy in a hat - Larry Wall? (for comparison: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-HAXGD3JE7pU.html)
@DimitriSabadie
@DimitriSabadie 8 лет назад
As a Haskeller, I just laughed my ass off watching that.
@josephlagrange9531
@josephlagrange9531 Год назад
Dijkstra and Wirth spoke negatively about C++. Stroustrup lobbied C++ at that time. At fact I agree with some dudes claiming Stroustroup is far from good designer.
@unk1nd7
@unk1nd7 8 лет назад
LOL xDD
@childhood1888
@childhood1888 2 года назад
31:33
@f8881f
@f8881f 5 лет назад
43:56
@user-tr3qt3qs9t
@user-tr3qt3qs9t 6 лет назад
The good C++ already exists and it is called D. Instead of adding more keywords and new layers of abstract concepts they would better just throw away all the heaps of random junk they have already added during the last 20 years and see how C-like OOP, templates and proper memory management for medium to big projects should really look like.
@ytsas45488
@ytsas45488 5 лет назад
Use Rust. It doesn't fall for the same backwards-compatible spaghetti that dooms C++, and doesn't use a tracing GC like D does unnecessarily. And D has questionable decisions, such as carryovers like function overloading and arbitrary additions like @properties.
@philophile147
@philophile147 8 лет назад
I know a UX designer who may be interested, messaging him now.
@13Septem13
@13Septem13 8 лет назад
No lol
@marianwitek403
@marianwitek403 8 лет назад
fuck!!! I love C++ but this? many things are adding like pushing wall ;/ remeber spaghetti code at 80's 90's, object oriented programming was one of solve this problem including c++, now, if this modern c++ isn't spaghetti code what the fuck is!? I understand language must to evolution, example c++11 but knowing every difficulty to coding and solving problems that should be enjoyable but this is bull shit!! More pleasure writing assembly
@voxelamateur
@voxelamateur Год назад
A _smaller_ and _simpler_ C++? the man has lost its mind...
@moderncpp
@moderncpp Год назад
4:25 Carbon folks don't want to listen!
@aigarius
@aigarius 7 лет назад
Yay, C++ community has invented pylint.
@biplabdas2408
@biplabdas2408 6 лет назад
shit is better/.........
@MrTargetSan
@MrTargetSan 8 лет назад
Let's say "--enforce rust-use" flag :)
@kushagraverma7855
@kushagraverma7855 2 года назад
rust
@VamoAComeLaPapa
@VamoAComeLaPapa 8 лет назад
Rust propaganda machine detected (I mean, Rust trolls). Nice language, enjoy it, but without trolling.
@Littlefighter1911
@Littlefighter1911 7 лет назад
He sounds a little like Trump and Dr.Evil (from Austin Powers) ._. Not the content, but the way of speaking.
@martinda7446
@martinda7446 7 лет назад
C++ is just a bit better than mediocre.
@zahash1045
@zahash1045 Год назад
A better title would be "how to write rust but in c++" lol
@paxdei1988
@paxdei1988 7 лет назад
Go is crippled rubbish.
@TheMrKeksLp
@TheMrKeksLp 3 года назад
Go and C++ aren't in the same class of tools so it's a bit unfair to say Go is a bad version of C++
@dawidbujak
@dawidbujak 6 лет назад
Bjarne, change haircut please
@chronius9496
@chronius9496 8 лет назад
Actually it is bullshit, if you need to write new code, but also maintain another you need to understand all of it. C++ is bloated and fat feature monster. Is it bad or good only time will show.
@SleazyNice
@SleazyNice 6 лет назад
Writing Good C++ code is not possible because C++ is shit. All OOP is shit and should not be used.
@tomburris8380
@tomburris8380 6 лет назад
Really? What would you suggest as an alternative? :)
@SleazyNice
@SleazyNice 6 лет назад
Just use C.
Далее
Bjarne Stroustrup: C++ | Lex Fridman Podcast #48
1:47:13
🌮 Taco Salad Bourbon Queso Bites #Shorts
01:00
Просмотров 4,2 млн
Bjarne Stroustrup - The Essence of C++
1:39:11
Просмотров 1,2 млн
Python 3 Metaprogramming
3:00:24
Просмотров 243 тыс.
🌮 Taco Salad Bourbon Queso Bites #Shorts
01:00
Просмотров 4,2 млн