Тёмный

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

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

www.cppcon.org
--
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/iso...
--
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/reg...
*-----*

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

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 140   
@thesanctuary225
@thesanctuary225 5 лет назад
Thank you sir Dennis Ritchie. Thank you sir Bjarne Stroustrup. You totally changed history of mankind.
@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++?
@VoidloniXaarii
@VoidloniXaarii Год назад
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...
@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 9 лет назад
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...
@MikeDiack
@MikeDiack 9 лет назад
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.
@enhex
@enhex 9 лет назад
"competing with C++ over the years has not been a winning strategy."
@kuchenzwiebel7147
@kuchenzwiebel7147 4 года назад
For the long term....
@aeluned
@aeluned 9 лет назад
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
@MrTargetSan
@MrTargetSan 9 лет назад
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.
@QuentinUK
@QuentinUK 8 лет назад
GSL Guidelines Standard Library.
@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 2 года назад
I imagine his mind sees more beauty and complexity in the commonplace simple things so they are impressive to him.
@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.
@kaboissonneault
@kaboissonneault 9 лет назад
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
@baltazarus3307
@baltazarus3307 5 лет назад
Excellent presentation Mr. Stroustrup, I enjoyed.
@bjarnestronstrup9122
@bjarnestronstrup9122 5 лет назад
Technically speaking it's Dr. Stroustrup.
@baltazarus3307
@baltazarus3307 4 года назад
@@bjarnestronstrup9122 xD true!
@MikeDiack
@MikeDiack 9 лет назад
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...
@Littlefighter1911
@Littlefighter1911 7 лет назад
34:32 I accidentally did this and it has NOT been caught be the compiler, neither MSVC nor GCC.
@philophile147
@philophile147 9 лет назад
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!
@michal.gawron
@michal.gawron 9 лет назад
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. ;-)
@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 7 лет назад
Any other trojans? Are you implying it was done before?
@ProphetPX
@ProphetPX 6 лет назад
hahaha what do you think "Security Enhanced" Linux distros are??? LOLLL :)
@adrienhamelin484
@adrienhamelin484 9 лет назад
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).
@vimleshkumarkanaujiya
@vimleshkumarkanaujiya 4 года назад
Legend behind Real Programming Language...
@SatansSpatula
@SatansSpatula 9 лет назад
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.
@AbcDino843
@AbcDino843 4 года назад
26:15, umm, should that not be q->use()?
@KangJangkrik
@KangJangkrik 4 года назад
That's the point of the topic
@atoshdustosh2762
@atoshdustosh2762 10 месяцев назад
Very useful concepts.
@dudanov
@dudanov 5 лет назад
Thank you, Bjarne!
@andik70
@andik70 8 лет назад
anybody has some links to good c++(14) code? (not the guideline, just leading by example)
@siweiliao4557
@siweiliao4557 7 лет назад
facebook/folly
@antonpetrenko9176
@antonpetrenko9176 2 года назад
one of the best hydra fighter!=)
@robfielding8566
@robfielding8566 9 лет назад
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.
@TheBuzzSaw
@TheBuzzSaw 9 лет назад
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.
@KananDethin
@KananDethin 8 лет назад
Thank you. Watched the whole video.
@GeorgeTsiros
@GeorgeTsiros 5 лет назад
GARRETT turbo, i'm sold 🤘
@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++?
@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 9 лет назад
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.
@Trollkemada
@Trollkemada 9 лет назад
You should probably add the github link to the video description.
@SunggukLim
@SunggukLim 7 лет назад
he is good speaker
@childhood1888
@childhood1888 2 года назад
One should not quote himself but it is a good quote.🙂
@ВладимирГ-о6ч
@ВладимирГ-о6ч 8 лет назад
Свершилось! Лед тронулся еще в 11, но 14 это уже будующее в настоящем.
@desertshadow72
@desertshadow72 2 года назад
Talk really gets started around 7:00 ish
@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
@enhex
@enhex 9 лет назад
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.
@MrTargetSan
@MrTargetSan 9 лет назад
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.
@brotherhood_of_harkonnen
@brotherhood_of_harkonnen 2 года назад
24:52: resource management
@michaelmoser4537
@michaelmoser4537 9 лет назад
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.
@Illasera
@Illasera 8 лет назад
Writing good C++ code, you don't, And never forget, "Avoing using linked list because, bad" - Bjarne Stroustrup
@deusbuda
@deusbuda 9 лет назад
muito bom...
@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
@Jiskov
@Jiskov 9 лет назад
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.
@chaosmeist3r
@chaosmeist3r 9 лет назад
already fixed in the repository
@aliveho2720
@aliveho2720 6 лет назад
I love c++;
@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.
@MikeDiack
@MikeDiack 9 лет назад
Absolutely right SS. C++ has just turned into a mess.
@КириллРагузин-р9в
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.
@DimitriSabadie
@DimitriSabadie 9 лет назад
As a Haskeller, I just laughed my ass off watching that.
@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)
@moseswachira1165
@moseswachira1165 8 лет назад
congrant
@enhex
@enhex 9 лет назад
57:27 Is that Gabe Newell?
@childhood1888
@childhood1888 2 года назад
31:33
@f8881f
@f8881f 5 лет назад
43:56
@13Septem13
@13Septem13 9 лет назад
No lol
@kushagraverma7855
@kushagraverma7855 2 года назад
rust
@VamoAComeLaPapa
@VamoAComeLaPapa 9 лет назад
Rust propaganda machine detected (I mean, Rust trolls). Nice language, enjoy it, but without trolling.
@biplabdas2408
@biplabdas2408 6 лет назад
shit is better/.........
@zahash1045
@zahash1045 2 года назад
A better title would be "how to write rust but in c++" lol
@aigarius
@aigarius 8 лет назад
Yay, C++ community has invented pylint.
@chronius9496
@chronius9496 9 лет назад
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.
@MrTargetSan
@MrTargetSan 9 лет назад
Let's say "--enforce rust-use" flag :)
@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.
@dawidbujak
@dawidbujak 6 лет назад
Bjarne, change haircut please
@ekimr90
@ekimr90 9 лет назад
Of course there's dislikes! It's because C++14 isn't Assembly.
@razterizer
@razterizer 8 лет назад
Bjarne rules.
@aliancemd
@aliancemd 9 лет назад
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
@voxelamateur
@voxelamateur 2 года назад
A _smaller_ and _simpler_ C++? the man has lost its mind...
@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.
@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?
@lodathi
@lodathi 8 лет назад
Amazing truths! I wish more young graduates thought this way.
@infomaks-pl
@infomaks-pl 9 лет назад
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
@MrTargetSan
@MrTargetSan 9 лет назад
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.
@DaveYostCom
@DaveYostCom 8 лет назад
54:59 With these guidelines you can get perfect resource safety and resource safety. The talk perhaps should have started here.
@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
@annaoaulinovna
@annaoaulinovna 4 года назад
c++ is awesome this guy must take nobel prize of computer science
@maximmarchal9991
@maximmarchal9991 3 года назад
11:40 wait why wouldn't they use new and delete after take-off?
@moderncpp
@moderncpp 2 года назад
4:25 Carbon folks don't want to listen!
@SatansSpatula
@SatansSpatula 9 лет назад
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 7 лет назад
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)
@freshsheets_
@freshsheets_ 6 лет назад
So basically just don't use 'new' or 'delete'
@todorsamardzhiev144
@todorsamardzhiev144 Год назад
3:10 oof, based
@philophile147
@philophile147 9 лет назад
I know a UX designer who may be interested, messaging him now.
@clodgozon3968
@clodgozon3968 5 лет назад
I clearly understand the topic. Good job, C++ Creator!
@VamoAComeLaPapa
@VamoAComeLaPapa 9 лет назад
This is not a language war, my friends!
@unk1nd7
@unk1nd7 8 лет назад
LOL xDD
@chaosmeist3r
@chaosmeist3r 9 лет назад
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 . ->
@amirishere
@amirishere 9 лет назад
Every time you say "it's painful", I want to say "I feel your pain".
@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?
@paxdei1988
@paxdei1988 8 лет назад
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++
@SleazyNice
@SleazyNice 7 лет назад
Writing Good C++ code is not possible because C++ is shit. All OOP is shit and should not be used.
@tomburris8380
@tomburris8380 7 лет назад
Really? What would you suggest as an alternative? :)
@SleazyNice
@SleazyNice 7 лет назад
Just use C.
Далее
Full Interview With the Creator of C++
23:30
Просмотров 42 тыс.
Свожу все свои тату (abricoss_a_tyt)
00:35
+1000 Aura For This Save! 🥵
00:19
Просмотров 5 млн
Abstraction Can Make Your Code Worse
5:13
Просмотров 649 тыс.
Being Competent With Coding Is More Fun
11:13
Просмотров 79 тыс.
Bjarne Stroustrup: C++ | Lex Fridman Podcast #48
1:47:13
Microservices are Technical Debt
31:59
Просмотров 304 тыс.
15 Years Writing C++ - Advice for new programmers
4:04
Bjarne Stroustrup: Why I Created C++ | Big Think
4:48
How different are C and C++? Can I still say C/C++?
10:25
WHY did this C++ code FAIL?
38:10
Просмотров 259 тыс.