Bjarne Stroustrup: C++ Zero-Overhead Principle and Object-Oriented Programming

  Переглядів 77,155

Lex Fridman

Lex Fridman

4 роки тому

This is a clip from a conversation with Bjarne Stroustrup from Nov 2019. New full episodes are released once or twice a week and 1-2 new clips or a new non-podcast video is released on all other days. You can watch the full conversation here: • Bjarne Stroustrup: C++...
(more links below)
Podcast full episodes playlist:
• Lex Fridman Podcast
Podcasts clips playlist:
• Lex Fridman Podcast Clips
Podcast website:
lexfridman.com/ai
Podcast on Apple Podcasts (iTunes):
apple.co/2lwqZIr
Podcast on Spotify:
spoti.fi/2nEwCF8
Podcast RSS:
lexfridman.com/category/ai/feed/
Note: I select clips with insights from these much longer conversation with the hope of helping make these ideas more accessible and discoverable. Ultimately, this podcast is a small side hobby for me with the goal of sharing and discussing ideas. I did a poll and 92% of people either liked or loved the posting of daily clips, 2% were indifferent, and 6% hated it, some suggesting that I post them on a separate UKposts channel. I hear the 6% and partially agree, so am torn about the whole thing. I tried creating a separate clips channel but the UKposts algorithm makes it very difficult for that channel to grow. So for a little while, I'll keep posting clips on this channel. I ask for your patience and to see these clips as supporting the dissemination of knowledge contained in nuanced discussion. If you enjoy it, consider subscribing, sharing, and commenting.
Bjarne Stroustrup is the creator of C++, a programming language that after 34 years is still one of the most popular and powerful languages in the world. Its focus on fast, stable, robust code underlies many of the biggest systems in the world that we have come to rely on as a society. If you're watching this on UKposts, many of the critical back-end component of UKposts are written in C++. Same goes for Google, Facebook, Amazon, Twitter, most Microsoft applications, Adobe applications, most database systems, and most physical systems that operate in the real-world like cars, robots, rockets that launch us into space and one day will land us on Mars.
Subscribe to this UKposts channel or connect on:
- Twitter: / lexfridman
- LinkedIn: / lexfridman
- Facebook: / lexfridman
- Instagram: / lexfridman
- Medium: / lexfridman
- Support on Patreon: / lexfridman

КОМЕНТАРІ: 200
@lexfridman
@lexfridman 4 роки тому
This is a clip from a conversation with Bjarne Stroustrup from Nov 2019. New full episodes are released once or twice a week and 1-2 new clips or a new non-podcast video is released on all other days. If you enjoy it, subscribe, comment, and share. You can watch the full conversation here: ukposts.info/have/v-deo/rYSphnxsmJ1jmHU.html (more links below) Podcast full episodes playlist: ukposts.info/slow/PLrAXtmErZgOdP_8GztsuKi9nrraNbKKp4 Podcasts clips playlist: ukposts.info/slow/PLrAXtmErZgOeciFP3CBCIEElOJeitOr41 Podcast website: lexfridman.com/ai Podcast on Apple Podcasts (iTunes): apple.co/2lwqZIr Podcast on Spotify: spoti.fi/2nEwCF8 Podcast RSS: lexfridman.com/category/ai/feed/
@Anonymous-nj2ow
@Anonymous-nj2ow 4 роки тому
"when i was designing c++" what a gangster
@BackToBackSWE
@BackToBackSWE 3 роки тому
yeah big 🍆 energy
@charliebitmyfinger7124
@charliebitmyfinger7124 Рік тому
@pedro gomes tell me you don't know anything about CPP without actually telling me
@Abon963
@Abon963 Рік тому
​​@pedro gomes bro stop u really don’t Know a shit about c++ it's not only C + classes
@manit77
@manit77 4 роки тому
Please note kids, he said c++ has oop features not an oop language like java or c#
@loam
@loam 3 роки тому
dude, in C# you can also use OOP technique, functional technique (because there's delegates and such; LINQ is basically functional programming if you like) or others if you want to do so. I bet same goes for Java (I'm mostly program in C# and don't have much experience in Java, except the examples I read in books)
@danb2108
@danb2108 3 роки тому
@@loam he means the basic memory management mechanisms and language primitives are not designed around the OOP paradigm as in Java, C# or the big contender at the time SmallTalk (I still use Smalltalk at my job), OPP in C++ are features on a higher level of abstraction not fundamental in the language design.
@yasserarguelles6117
@yasserarguelles6117 3 роки тому
@@loam In Java you can't declare things outside of a class forcing you to use classes, pretty sure the same goes for C#. C++ can be procedural without the need for any classes, matter of fact I don't think I ever need classes in C++ or certain other OOP features
@IamusTheFox
@IamusTheFox 3 роки тому
@@loam True, you can do some functional things in an OO context. C++ can be used well with out a single class, on the same hand, it's not true OO because things are not derived from an ultimate root/base object. There isn't implicit boxing and unboxing in C++ like there are in pure OO languages.
@mehmetdemir-lf2vm
@mehmetdemir-lf2vm 3 роки тому
c++ is not an oop language because it does not force you to write object oriented code. it has more oop features than java like multiple inheritance.
@battonfive
@battonfive 3 роки тому
Bjarne is one of my long time heroes :-) some people look to footballers, astraunauts, quantum physists and sure i respect them all! but I love Bjarne :-D I mean I write in PHP but C++ is legend!
@Jacno77
@Jacno77 3 роки тому
Would you have dinner with him but at the end of it you have to give him head?
@benvella1728
@benvella1728 2 роки тому
@@Jacno77 asking the real questions
@federicoalbesa3748
@federicoalbesa3748 2 роки тому
Saludos! Hermano del alma
@melvin4524
@melvin4524 2 місяці тому
The guy has never shipped production code, ever. But people praise him for adding shitty features whose efficiency wasn't measured at all, to a language that has existed since the 70s and which was used to design programs made in the 80-90s that still works today ( i.e WindowsNT and Linux were made with C).
@thogameskanaal
@thogameskanaal 3 роки тому
It's fascinating how much one or two people can do. If they have a clear challenge, and a bit of insight, they're very capable of doing a lot of research, gathering knowledge and experience in the process and eventually solve it in an efficient and intuitive manner. When you have a large group (say an enterprise organization), you have to worry about communication and coherence a lot. Basically ideas that sound bad on paper, but lead you closer to the answer are immediately dismissed in a larger group, while with one or two people, they'd at the very least attempt it and refine it, or scrap it but get insight on why it wouldn't work. Never underestimate the power of smart and motivated individuals. Their crazy ideas might have more merit than you think!
@kensei4237
@kensei4237 3 роки тому
Makes sense I guess
@squishmastah4682
@squishmastah4682 3 роки тому
I know. I'm consistently WRECKING IT solo or in small collabs.
@Artaxerxes.
@Artaxerxes. 2 роки тому
Id say 4 is the limit and thats a generous number. Any more and the group totally breaks apart
@3145mimosa
@3145mimosa 4 роки тому
I like this part, and the part of history of programming languages in 60s most in the interview. Thank you for your great work on this!
@megoo401
@megoo401 4 роки тому
Please bring in James Gosling as well, that would be GREAT!! and a treat.
@_____case
@_____case 3 роки тому
Thy will be done.
@wednesdayaddams718
@wednesdayaddams718 8 місяців тому
every day i needed to learn this stuff in my univ...yo.. it makes me cry but anyhow one day i wish to conquer it !!! this guy represents the entire generation lovely ..
@0dyss3us51
@0dyss3us51 3 роки тому
Even though I program in other langs tgan C++ I consider Bjarne to be a god damn legend and C++ a masterpiece!
@Anteksanteri
@Anteksanteri Рік тому
To be fair you're allowed to think that C++ is a masterpiece if you don't actually have to use it 😩
@budiardjo6610
@budiardjo6610 Рік тому
this is the first time i seeing bjarne so much happier
@Calypso694
@Calypso694 3 роки тому
Learning it now. How and why this became the norm for nearly everything is beyond me.
@squishmastah4682
@squishmastah4682 3 роки тому
Part of the answer is because it strikes a good balance between efficiency and ease of use. Part of the answer is in comparing it to everything that came before.
@scottanderson2871
@scottanderson2871 Рік тому
I learned it decades ago. STL has improved - I mean back in the day it was so buggy we used to use the dinkum library in place of it. It’s really a terrible language. ukposts.info/have/v-deo/aZllYZtopqGL1as.html
@richardistvanthier5620
@richardistvanthier5620 3 роки тому
The existence of the zero overhead principle in itself is already half the magic:in many languages they just think of an abstraction and if it is implementable in a "not awfully slow" way they do it. Then hope that the implementations in compilers once grow optimal. But the problem is that this way there are high chances that they miss something really similar feature that is maybe not solving the same problem, but is "good for nearly the same". In other worlds: c++ is great because it is not just a language -> compiler directional thinking, but many times they look for language features from the oher direction! They do bottom -> top thinking instead of top -> bottom. That is the magic.
@robertstimmel1100
@robertstimmel1100 3 роки тому
You can thank this guy for the vast majority of modern Triple-A video games. Unreal Engine uses C++ as well as many other proprietary engines. Edit: After listening all of the way through, I doubt that anyone listening to this is unaware of what languages video games are written in. This is pretty high level lol
@hexadecimalhexadecimal5241
@hexadecimalhexadecimal5241 3 роки тому
Yeah its a beast of its own, i still remember my first language....C. It was lets just say an experience. Planning on revisiting it though.
@robertstimmel1100
@robertstimmel1100 3 роки тому
@@hexadecimalhexadecimal5241 I'm learning C# now. It's pretty tough because I'm going the self taught route, but it's been fun and rewarding (and really frustrating at times)
@cristiancosneanu
@cristiancosneanu Рік тому
@Robert Stimmel The Devs of unreal are responsible for Triple-A video games. This guy is responsible for making a language that got popular. Games & game engines would've emerge from different languages. Look at Unity.
@oh-yes_10-fps15
@oh-yes_10-fps15 10 місяців тому
@@cristiancosneanuwhile i 101% agree the lang doesn’t matter for video games and language debates are usually pointless for from the ground projects like game engines. It’s important to note a vast amount of unity’s backend in cpp. Just the user/dev facing scripting system and so bindgen between the cpp and CLR is c#
@user-yz7fr6kd7y
@user-yz7fr6kd7y 10 місяців тому
C++ is not my favorite language, but I can't deny it's perhaps the most powerful out there.
@jboadas
@jboadas Рік тому
Please activate automatic subtitles on these amazing videos
@alexk6275
@alexk6275 3 роки тому
It's a beautiful principle and I wish it held up in other languages, especially those on the JVM.
@euclid9492
@euclid9492 3 роки тому
Yeah java is beautifully simple to me, I wish it had the same performance as well.
@alexk6275
@alexk6275 3 роки тому
I personally prefer Scala after having some time to learn it. But the nice functional abstractions end up hurting performance for pretty much any CPU bound task. You end up reverting to loops and mutable variables which feel very out of place.
@kevalan1042
@kevalan1042 3 роки тому
The JVM itself fails on this principle, seems to me. Performance tuning on JVM is like voodoo black magic
@bagzhansadvakassov1093
@bagzhansadvakassov1093 3 роки тому
@@kevalan1042 Java is only 1.8 times slower than C. Which if you think about it is crazy.
@kevalan1042
@kevalan1042 3 роки тому
@@bagzhansadvakassov1093 The JVM is indeed impressive, but 80% cost is definitely not zero-overhead. Also, optimizing C is *much* more principled and predictable than optimizing JVM-targeting code
@osamaa.h.altameemi5592
@osamaa.h.altameemi5592 3 роки тому
That was fantastic
@binarytv2904
@binarytv2904 2 роки тому
So C++ is like a giant toolbox with thousands of small and unique tools which are there to do only specific tasks. The efficiency and performance of your work depends upon which tools you took out of the box and use. You can substitute certain tools for other but don't expect similar performance (but the option is still there). So you need to have a good idea and understanding of all the tools you have at your disposal. Abstraction is a double edged sword. I actually understood it only after learning GDB and debugging some programs. That's when I got to see the assembly codes and finally saw myself how there are some instructions which otherwise I could have omitted but it's there just because I used the wrong tool. Languages like python gives you one giant tool to do a variety of otherwise dissimilar tasks but at the cost of performance.
@medusaskull9625
@medusaskull9625 3 роки тому
It's not efficiency vs abstraction. It's efficiency vs deliverable. How long does it take to bring an idea to market vs how efficient is your code is in utilizing system hardware. In biological system, the things that we thought are unnecessary and inefficient became efficient and necessary when they deep analyzing it.
@deepblueharvest
@deepblueharvest Рік тому
RE the discussion starting at 3:27, I in fact did write a matrix multiplication subroutine in Fortran that runs faster than the intrinsic MATMUL function about 60% of the time, but that difference might just be statistical noise lol
@Funny_Family582
@Funny_Family582 Рік тому
This man is really amazing
@jasoncrawford1489
@jasoncrawford1489 3 роки тому
5:43: Just to clarify, the word he used was "assembler".
@thomasanderson621
@thomasanderson621 3 роки тому
This danish man change the story of humanity forever, like Denis Ritchie.
@mehmetdemir-lf2vm
@mehmetdemir-lf2vm 3 роки тому
yes, and he protected us from "subjective" c, which some fruit company likes very much.
@pedromiguelareias
@pedromiguelareias 3 роки тому
Bjarne: sorry, faster than Fortran? As fast as Fortran, perhaps, and that only after imposing access constraints present in that Language (in C "restrict"). It's basically over now with people such as Scott Meyers abandoning ship. C++03 could have been cleaned up. What happened since then was crazy.
@MCLooyverse
@MCLooyverse 3 роки тому
Maybe I'm missing something, but I just remembered when I wrote a program to draw the Mandelbrot Set to a bitmap file, and it was very slow. I had written a whole `Complex` class that (in that context) was only doing multiplication and norm, then I stripped that out, and just did the multiplication by hand, and it ran way faster.
@JakeLaMtn
@JakeLaMtn 3 роки тому
I might be wrong, but I think you could do it just as fast with a complex class. But done incorrectly, it could definitely introduce inefficiencies.
@igorsilva8791
@igorsilva8791 3 роки тому
He is talking about using a good abstraction, not any abstraction.
@ekremdincel1505
@ekremdincel1505 3 роки тому
@@igorsilva8791 lol
@edunery
@edunery 9 місяців тому
@@igorsilva8791what defines a good abstraction? “You are not doing it right” isn’t good advice
@paulkiat
@paulkiat 2 роки тому
"My main tool for efficiency is abstraction" - Bjarne Stroustrup
@abelgerli
@abelgerli 3 роки тому
Actually I loved C++ but I got the real problem that when you messed up the catch part and by mistake produced a exception there the whole software crashed unrecoverable. I never got in any problems with performance and looking at the const option it was just decades ahead when I think of functional programming today. I hope the catch crash problem can be handle today way better today.
@jeffmccloud905
@jeffmccloud905 3 роки тому
all try...catch work this way, regardless of language (C#, Java, JavaScript, etc.)... your catch handler should never do anything that would throw an error. that is an "unhandled error". unhandled errors cause crashes. this is not a C++ thing. just use better error handling practices
@ekremdincel1505
@ekremdincel1505 3 роки тому
Use something like Rust's Result maybe?
@ekremdincel1505
@ekremdincel1505 3 роки тому
@@jeffmccloud905 I think swift makes exceptions more explicit.
@JamieVegas
@JamieVegas Рік тому
Anywhere to find publicly written code by Bjarne? His GitGub lacks OO related projects.
@scottanderson2871
@scottanderson2871 Рік тому
ukposts.info/have/v-deo/aZllYZtopqGL1as.html
@edunery
@edunery 9 місяців тому
Maybe his GitHub does
@jasoncrawford1489
@jasoncrawford1489 3 роки тому
Does anyone have a pointer to Doug McIlroy's discovery of C++ being faster than C?
@sasuke2910
@sasuke2910 3 роки тому
It's funny how he can be so bold about being faster than low level code "most of the time". Maybe you can write a heap sort that's faster on certain hardware. But high abstraction applications have been trending slower and slower, and the likely culprit is something in the paradigms, but he seems in denial that such a problem could even exist.
@corinsenok
@corinsenok 3 роки тому
yer funny how the dude who designed and tested this shit for decades has a deep perspective of the inner workings. super odd.
@shashishekhar----
@shashishekhar---- 3 роки тому
@@corinsenok Not his point though.
@corinsenok
@corinsenok 3 роки тому
@@shashishekhar---- nor was it bjarnes point.
@MisterFanwank
@MisterFanwank 3 роки тому
Object oriented programming and zero cost abstractions are mutually exclusive. A compiler cannot inline a function if it doesn't know what function is going to be called.
@revimfadli4666
@revimfadli4666 3 роки тому
Due to polymorphism? Doesn't c++ identify which one's which through parameter types?
@michaelrosen6478
@michaelrosen6478 3 роки тому
Correct. But on the other hand, what would be the alternative implementation? Branching? Branching also has a cost. So you just have to pick your cost in some situations.
@SnakeEngine
@SnakeEngine Рік тому
Zero overhead abstraction doesn't mean zero cost. It means you couldn't implement it any faster manually.
@JMRC
@JMRC Рік тому
@@revimfadli4666 It does. As long as you don't use virtual functions, it's known at compile time. It can then be inlined and therefore use zero cost.
@Anteksanteri
@Anteksanteri Рік тому
You are so completely wrong on this, and I am a big detractor of OOP. An object in memory is just an instance + functions. If you know the type, you know the function. Polymorphism is a separate thing. Also, not all inlinings are really zero cost (not that such a thing even exists). Sometimes saving memory is more important.
@fernsugi
@fernsugi 3 роки тому
I watch this to sleep
@carlkohrs9857
@carlkohrs9857 2 роки тому
"And" - Bjarne Stroustrup
@lenfirewood4089
@lenfirewood4089 3 роки тому
Aren't a lot of the efficiency measures designed into the language also offset by the run time libraries needed to support all its functions?
@lenfirewood4089
@lenfirewood4089 3 роки тому
@@__Brandon__ Do your homework before responding - it is hardly a secret that c++ relies on runtime libraries for a good deal of it's functionality.
@tridibroyarjo418
@tridibroyarjo418 3 роки тому
C++ is the God And Creator Language, None should make fun of C++. If, he will regret it!
@_____case
@_____case 10 місяців тому
Guest request: Chandler Carruth.
@zakeria
@zakeria 4 роки тому
hell yeah c++ concepts
@MuhsinFatih
@MuhsinFatih 4 роки тому
This man is the god of language design
@kensei4237
@kensei4237 3 роки тому
pedro gomes he designed c++ is all they were saying
@MuhsinFatih
@MuhsinFatih 3 роки тому
@@kensei4237 he's not even making an argument. He's pretending to have made an argument by showing off that he read a book and pointing to what I only assume is an opinionated text in the book. @pedro_gomes you cite papers and data, not opinions. now try again
@shashishekhar----
@shashishekhar---- 3 роки тому
@@MuhsinFatih Lol, did you read it tho...he right in calling out your opinionated fangirling.
@coolcodingcat
@coolcodingcat Рік тому
@@MuhsinFatih I looked up that book he speaks of and it costs money. I have to spend money to even see the page he is talking about. Edit: Maybe I can find it at the library.
@coolcodingcat
@coolcodingcat Рік тому
@pedro gomes is that page of the book available for free or do I have to spend money to see it?
@ericswenson1646
@ericswenson1646 4 роки тому
i think low coupling is more important than object orientation
@eidiazcas
@eidiazcas 3 роки тому
Yes and no, it depends, low coupling is generally achieved through writing more code, wrappers, interfaces, etc, which for some small applications it's not worth it, object orientation is just a way to not repeating code, it just works on the short term, the best language to handle that equilibrium is golang, where you make composition instead of inheritance but you do it in an inheritance way and have the best of both worlds
@nexovec
@nexovec Рік тому
So why is it not zero-overhead then?
@Rigardoful
@Rigardoful 3 роки тому
Answer to first question: Apparently you don't
@angrycoder8808
@angrycoder8808 3 роки тому
bring james gosling🤔🤔🤔🤔
@Wiedzemir
@Wiedzemir 3 роки тому
The biggest issue with C++ at the moment is the misguided clinging to backwards compatibility. Just deprecate older instructions already. It's too bloated.
@natheirabu-dahab9863
@natheirabu-dahab9863 3 роки тому
Exaclty, so many things exist just for the backwards compatibility that it bloats the language. Either remove the unnecessary new stuff (like classes, we already have structs, why do we need classes?) Or forget backwards compatibility.
@gwills9337
@gwills9337 3 роки тому
seems really short sighted to remove backwards compatibility, for a marginal benefit
@natheirabu-dahab9863
@natheirabu-dahab9863 3 роки тому
@@gwills9337 fair point but it would also make the language easier and possibly faster. Also, because it would be nearly the same, a trans-compiler could be developed to translate C to C++.
@happygimp0
@happygimp0 3 роки тому
@machine C is so popular because of the preprocessor and many other things. You can not replace the preprocessor by templates. You can replace a lot of it but not all, especially on low level. Most programming languages that want to be a replacement for C do not have a preprocessor and they all failed to become popular.
@mettaursp309
@mettaursp309 3 роки тому
​@machine Templates in their current form are also a large part of what is wrong with modern C++. They are perfectly capable of doing very cool things with meta programming and are one of the big reasons why modern C++ is so good, but their current design is very deeply entrenched in backwards compatibility with techniques from older C++ versions. Many of the features that get added cater to building bridges around pitfalls that led to smelly code rather than addressing the core issues surrounding why the language fell short there. The pitfalls are still there, but they just aren't as visible as they were before. Two examples of really good features that were added that only partially mask really smelly code are C++17's fold expressions and std::apply. Fold expressions provide a shorthand way of expanding a template parameter pack without recursive templates, and std::apply provides a very nice method of unpacking a std::tuple's contents to be deployed as a function's arguments. These were both very big problems with C++'s method of meta programming with std::tuple argument expansion being particularly nasty. I love these two features because they are incredible simplifications of solutions to work around those problems, but because they are workarounds they betray the design flaws of C++'s templates. C++'s templates were never intended to be used for meta programming to my knowledge, so they weren't designed around it. However, because they were there and they were turing complete people started using them to generate and optimize run time code. I'd have to imagine this lead to an increased demand for new features to work around specific pain points with advanced template usage, and discovery of things like SFINAE further supported that usage. To be exact, I found a claim that many of these features were expanded upon specifically to aid development of the STL, and while I can believe it I cannot confirm or deny. Rather than getting a deliberately planned and well thought out meta programming feature we got expansions on templates that made them easier to use. I appreciate all the work that has been put into expanding their capabilities, but I also can't help but wish we got a cleaner and more intuitive abstraction for the features we currently rely on templates for.
@KianSheik
@KianSheik 3 роки тому
real life yoda
@NiinaSKlove
@NiinaSKlove 3 роки тому
Erling P. Strand
@happygimp0
@happygimp0 3 роки тому
The problem with C++ is compile time. Did you ever try to compile chromium?
@meuko
@meuko 3 роки тому
Bruh, dont act like you work on projects that size everyday.
@ycombinator765
@ycombinator765 Рік тому
@@meuko hehe got em
@sayokbhattacharya
@sayokbhattacharya 3 роки тому
Is Bjarne a BDFL?
@Oodelally
@Oodelally 3 роки тому
That’s guido van rossum for python
@michaelrosen6478
@michaelrosen6478 3 роки тому
No - he doesn't actually have final control over C++ because it's created by a standards committee. He is just a "first among equals" kind of thing.
@nmagko
@nmagko 4 роки тому
IMHO it's very difficult to compare C++ and C. If you are a C++ expert trying to rewrite your code in C sometimes you're going to make mistakes. A very good coding in C has not performance comparison to another high level programming language.
@gustavcc.m.7311
@gustavcc.m.7311 4 роки тому
So 'C' is better..?.i think is more complicated.
@nmagko
@nmagko 4 роки тому
@@gustavcc.m.7311 Not difficult. It takes time but you can take advantage of pointers. C++ has objects (of different type) you can create and destroy. C has pointers (of any type) you can allocate and free.
@coshvjicujmlqef6047
@coshvjicujmlqef6047 4 роки тому
@@nmagko My question is WHY do you malloc/free/new/delete. What's wrong with T object. instead of T* object=new T; or auto object=std::make_unique(); ? It makes no sense for me. pointer is abused a lot in today's world.
@Anonymous-nj2ow
@Anonymous-nj2ow 4 роки тому
@@gustavcc.m.7311 Joel Spoelsky, former CEO of Stackoverflow has said pretty much every programmer should know C
@tommasobonvicini7114
@tommasobonvicini7114 4 роки тому
Thinking that a difference between languages is "C++ has objects while C has pointers and raw memory management" is plain wrong.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 3 роки тому
Unfortunately, the “zero-overhead” principle has to be abandoned every time you try to do something actually useful with the language. Like anything involving dynamic memory allocation. Or the first time you discover that a “delete” method has to be explicitly declared virtual to avoid certain unpleasant surprises. Which means your class now has to have a vtable. And you wonder, don’t proper OO languages have tables for _all_ their classes?
@igorswies5913
@igorswies5913 3 роки тому
OOP is designed to be slow
@richardistvanthier5620
@richardistvanthier5620 3 роки тому
I routinely write months of code without ever writing a destructor and try to minimize dynamic memory altogether. You seem to try using c++ in java/C# style maybe???
@IamusTheFox
@IamusTheFox 3 роки тому
In C++ that's c++11 and newer, there is very few reasons to use new/delete. I've written an entire state machine that is optimized away at compile time.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 3 роки тому
Given the myriad applications of dynamic memory, that must severely limit the kinds of applications you write. Consider that even text strings require dynamic memory, unless you impose arbitrary limits on the lengths of your buffers. Here is a discussion of how to manage dynamic memory: github.com/ldo/a_structured_discipline_of_programming
@IamusTheFox
@IamusTheFox 3 роки тому
@@lawrencedoliveiro9104 i didn't say dynamic memory. std::shared_ptr and std::unique_ptr instead of new and delete. In fairness I only glaced at it, but it looked like either c++03 or C.
@iternative1865
@iternative1865 Рік тому
And now comes Zig...
@frozen_tortus
@frozen_tortus 3 роки тому
Python has left the chat.
@Wiedzemir
@Wiedzemir 3 роки тому
What does Python has to do with anything? It's an interpreted languages not compiled. Can as well compare C++ with bash by this logic.
@Bobby.Kristensen
@Bobby.Kristensen 4 роки тому
This reminds me of: ukposts.info/have/v-deo/hWeYaqaulmaIkok.html
@crankyunicorn4423
@crankyunicorn4423 3 роки тому
this video was sposored by...Pepsi
@TimVerweij
@TimVerweij 4 роки тому
zero o'erhead :-)
@superuser8636
@superuser8636 4 роки тому
Tim Verweij “The what?” (;
@rubenpartono
@rubenpartono 3 роки тому
@@superuser8636 (Again) The seero o'erhead principle :-O
@superuser8636
@superuser8636 3 роки тому
@@rubenpartono It's been two months and I can just read your comment out loud without having to replay the clip to understand the video :D
@peterschmidt353
@peterschmidt353 3 роки тому
c++ as a language is completely crap++
@movax20h
@movax20h 3 роки тому
Zero overhead. LOL. How about you fix unique_ptr overheads. It is atrocious.
@ekremdincel1505
@ekremdincel1505 3 роки тому
Lol you are right
@MarquisDeSang
@MarquisDeSang Рік тому
Everything C++ do, I can do in pure C. I can object programming with heritage and do try catch in pure traditional C. Why does C++ exist. At least Objective-C is compatible with C.
@carloseduardosilvalima362
@carloseduardosilvalima362 3 роки тому
#include int main() { std::cout
@ccgb92
@ccgb92 4 роки тому
2:09. That's exactly what's happening with the language today, sad :(
@bigyanshrestha3035
@bigyanshrestha3035 4 роки тому
@@deepankararya1994 Adding features isn't always good.
@bigyanshrestha3035
@bigyanshrestha3035 4 роки тому
@@inxiti Agree on that! The point I was trying to make is one should be very selective while adding features to language.
@isura.m
@isura.m 4 роки тому
Which features are you talking about?
@stifflery
@stifflery 4 роки тому
@@deepankararya1994 , php, javascript etc
@neociber24
@neociber24 3 роки тому
@@isura.m that's a good question, features like move semantics, constexpr and others are really good
@anonymous2150
@anonymous2150 13 днів тому
one of the smartest people ever born in history.
Bjarne Stroustrup: C++ Concepts - Constraints on Template Parameters
10:24
How principled coders outperform the competition
11:11
Coderized
Переглядів 1,5 млн
Артем Пивоваров х Klavdia Petrivna - Барабан
03:16
Artem Pivovarov
Переглядів 7 млн
одни дома // EVA mash @TweetvilleCartoon
01:00
EVA mash
Переглядів 5 млн
Object Oriented Programming is not what I thought - Talk by Anjana Vakil
38:51
freeCodeCamp Talks
Переглядів 121 тис.
Best OS for programming? Mac vs Windows vs Linux debate settled
8:41
Object-Oriented Programming is Bad
44:35
Brian Will
Переглядів 2,3 млн
Bjarne Stroustrup: C++ Standards - C++03, C++11, C++14, C++17, C++20
10:20
Bjarne Stroustrup: Deep Learning, Software 2.0, and Fuzzy Programming
6:30
Will Javascript Take Over the World? | Brian Kernighan and Lex Fridman
3:40
Should you learn C++?? | Prime Reacts
20:29
ThePrimeTime
Переглядів 296 тис.
C++20: C++ at 40 - Bjarne Stroustrup - CppCon 2019
1:31:26
CppCon
Переглядів 273 тис.
(Life) Advice From The Creator of C++
3:18
Honeypot
Переглядів 687 тис.
Oral History of Bjarne Stroustrup
2:00:10
Computer History Museum
Переглядів 68 тис.
Samsung UE40D5520RU перезагружается, замена nand памяти
0:46
Слава 100пудово!
Переглядів 3,4 млн
Airpods’un Gizli Özelliği mi var?
0:14
Safak Novruz
Переглядів 1,4 млн
Игровой ноутбук за 100тр в МВИДЕО
0:58
KOLBIN REVIEW
Переглядів 504 тис.
M4 iPad Pro Impressions: Well This is Awkward
12:51
Marques Brownlee
Переглядів 5 млн
Как установить Windows 10/11?
0:56
Construct PC
Переглядів 1,9 млн