YouSaid · the spoken record

Bjarne Stroustrup

lines on the record
99
first
2019-11-07
most recent
2019-11-07
sittings or episodes
1
sources
podcast

Every line below is reproduced as it was said and linked to the record it came from. Nothing here is summarised or generated. Directory · Search · Corrections

  1. If it has just been statements on paper, on the screen, I don't think I could have kept going, but I get to see the telescopes up on Monarchia and I actually went and see how Ford built cars and I got to JPL and see how they do the Mars rovers. There's so much cool stuff going on and most of the cool stuff is done by pretty nice people and sometimes in very nice places Cambridge Sophia and Coulis, Silicon Valley, there's more to it than just code. But code is central.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  2. Obvious. I've spent a lot of time with C Is a combination of a few good ideas, a lot of hard work, and a bit of luck Tried to get away from it a few times, but I get dragged in again partly because I'm most effective in this area and partly because what I do has much more impact if I do it in the context of C++. I have four and a half million people that pick it up tomorrow. if I did it in another field I would have to start learning, then I have to build it and then we'll see if anybody wants to use it. One of the things that has kept me going for all of these years is one, the good things that people do with it and the interesting things they do with it. And also, I get to see a lot of interesting stuff and talk to a lot of interesting people.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  3. Let's just get one fact in. All of this AI stuff is on top of C So that's one reason I have to keep a weather eye out on what's going on in that field, but I will never become an expert in that area. It's a good example of how you separate different areas of applications and you have to have different tools, different principles and they interact. No major system today is written in one language and there are good reasons for that

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  4. But I'm sort of an amateur here. I've read some of the papers, but I've not ever done it. And the idea scares me the most. Is the one I have heard, and I don't know how common it is. You have this AI system, machine learning, all of these trained neural nets. And when there's something that's too complicated, they ask the human for help. But human is reading a book or sleep, and He has thirty seconds or three seconds to figure out what the problem was that the AI system couldn't handle and do the right th This is I mean, how do you do the codo between the machine and the human?

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  5. 84% accuracy rate at 16% for its positive rate is perfectly acceptable and where people will probably get no more than 70. You said 98% what I've seen is more like 84 and by really a lot of blood, sweat and tears you can get up to the 92 and a half So, this is fine if it is, say, pre-screening stuff before the human look at it, it is not good enough for life-threatening situations. And so there's lots of areas where the fuzziness is perfectly acceptable and good and better than humans, cheaper than humans, but it's not the kind of engineering stuff. I'm mostly interested in. I worry a bit about machine learning in the context of cars. You know much more about this than I do.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  6. I think it's a different kind of world, and it is fuzzy, and in my domain I don't like fuzziness People say things like they want everybody to be able to program. But I don't want everybody to program my aeroplane controls or the car controls. I want that to be done by engineers. I want that to be done with people that are specifically educated and trained for doing building things. And it is not for everybody. Similarly, a language like C++ is not for everybody. It is generated to be a sharp and effective tool for Professionals basically, and definitely for people who aim at some kind of precision. You don't have people doing calculations without understanding math. Counting on your fingers is not going to cut it if you want to fly to the And so there are areas where

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  7. Dispose patterns and such that imitate some of the construction destruction stuff. And they're trying not to use the garbage collection all the time. Things like that. So there's conversion. But I think we have to step back to the philosophical level, agree on principles, and then we'll see some conversions. And it will be application domain specific.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  8. Don't violate some kind of type system. There's many kinds of type systems, but when you have one, you don't break it, et cetera, et cetera. There will be quite a few. And it will not be the same for all languages. But I think if we step back at some kind of philosophical level, we can be able to agree on sets of principles that applied to sets of problem areas. And within An area of use like in C's case, what used to be called systems programming, the area between the hardware and the fluffier parts of the system You might very well see a convergence. So these days you see Rust having adopted RAI and sometimes accuses me for having borrowed it 20 years before they discovered it. But we're seeing some kind of conversion here instead of relying on garbage collection all the time. The garbage collection languages are doing things like the

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  9. Let's remember sort of modern physics, I think, started with Galileo in the 1300s, so they've had 700 years to get going. Modern computing started in about 49. We've got, what is that, 70 years. They have 10 times. And furthermore, they are not as bothered with people using physics the way we are worried about programming. It's done by humans. So each have Problems and constraints the others have, but we are very immature compared to physics. So I would look at sort of the philosophical level and look for fundamental principles like You don't leak resources, you shouldn't. You don't take errors at runtime that you don't need to.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  10. Suddenly, we started making progress. Said, I had this problem and I Developed it according to these ideas. And they said, why we had that problem, different problem, and we develop it with the same kind of principles. And so we worked through. Large chalks of C and large chunks of common lisp and figured out we actually had similar sets of principles of how to do it. The constraints on our designs were very different, and the aims for the usage was very different. But there was commonality in the way you reason about language features and the fundamental principles you are trying to do.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  11. And we were talking about languages and language features. Obviously, we didn't agree about anything because, well, Lisp was not C and vice versa.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  12. Well, I think That languages should be designed not by clobbering language features together Doing slightly different versions of somebody else's ideas through the Creation of a set of principles, rules of thumbs, whatever you call them, I made them for C++ and we're trying to. Teach people in the standards committee about these rules because a lot of people come in and say, I've got a great idea, let's put it in the language. And then you have to ask, why does it fit in the language? Why does it fit in this language? It may fit in another language and not here. Or it may fit here and not the other language. So you have to work from a set of principles and you have to develop that set of principles. One example that I sometimes remember is I was sitting down. With some of the designers of common Lisbon.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  13. Yeah, that's right. By the way, philosophy is important. You can't do good language design without philosophy because what you are determining is what people can express and how. Is very important The way constructors, destructors came into C in 79. In about the second week of my work with what was then called CB classes, it is a fundamental idea. Next comes the fact that you need to control copying. Because once you control, as you say, birth and death, you have to control taking copies, which is another way of creating an object. And finally, you have to be able to move things around. So you get the move operations. And that's the set of key operations you can define on a C++ type.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  14. It's the idea of constructor destructor pairs. Sometimes it comes out under the name R-A-I resource acquisition is initialization, which is the idea that you grab resources in the constructor and release them in destructor. It's also the best example of why I shouldn't be an advertising. I get the best idea and I call it resource acquisition is initialization. Not the greatest naming I've ever heard.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  15. I have written two papers for the history of programming languages conference, which basically asked me such questions, and I'm writing a third one which I will deliver at the history of programming languages conference in London next year. So I've been thinking about that. And there is one clear answer. Constructors and destructors. The way a constructor can establish the environment for the use of a type for an object and the destructor that cleans up any messes at the end of it. That is the key to C++. That's why we don't have to use garbage collection. That's how we can get predictable performance. That's how you can get the minimal overhead in many, many cases and kept really clean types.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  16. It'll happen. And furthermore, this gives a predictability that allows the implementers, the compiler implementers, the library implementers, they have a target and they deliver on it. Eleven took two years before most compilers were good enough. 14. Most compilers actually getting pretty good in 14. Seventeen everybody shipped in seventeen. We are going to have Least almost everybody ship, almost everything in twenty. And I know this because they're shipping in nineteen Predictability is good delivery on time is good. And so, yeah

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  17. And then people tried it with other things, and it didn't work so well. They got things in, but it wasn't as dramatic and it took longer and longer and longer. So after C11, which was a huge improvement, and what basically what most people are using today, Decided never again And so, how do you avoid those slips? And the answer is that you ship more often so that if you have a slip on a 10-year cycle, By the time you know it's a slip, there's 11 years till you get it. Now with a three year cycle, there is about three or four years till you get it, like the delay between feature freeze and shipping. So, you always get one or two years more. And so we shipped 14 on time. We shipped 17 on time. And we will ship 20 on time.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  18. And it took longer. Furthermore, there is this tendency because it's a 10-year cycle. H, doesn't matter. Just before you're about to ship, somebody has a bright idea. And so we really, really must. That in. We did that successfully with the STR. Got the standard library gives us all the STL stuff. Basically, I think it saved C. It was beautiful.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  19. Right. Well, the point is that this was sort of like a second system effect that is, we now knew how to do it, and so we're going to do it much better. We got more ambitious.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  20. The last was in'98, we voted it out, that was the standard that people used till 11 or a little bit past 11 Anderson international standard, all the countries voted in favor. It took longer with 11, and I'll mention why, but all the nations voted in favor. And we work on the basis of consensus that is we do not want something that passes 60-40 because then we're getting dialects and opponents and people complain too much. They all complain too much, but basically it has no real effect. The standards has been obeyed, they have been working to make it easier to use many compilers, many computers and all of that kind of stuff. And so the first, it was traditional with ISO standards to take 10 years, we did the first one and eight brilliant. And we thought we were going to do the next one in six because now we are good at it. It took 13.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  21. Based on the rest of the work on it, and we meet three times a year. Next week I'll be in Cologne, Germany, spending a week doing standardization, and we'll vote out the committee draft of C++20, which goes to the National Standards Committees for comments and requests for changes and improvements. Then we do that, and there's a second set of votes where hopefully everybody votes in favor. This has happened several times. First time we finished, we started in the first technical meeting was in

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  22. Exactly. As Churchill says, democracy is the worst way except for all the others, right? And it's, I would say, the same with formal standardization. But anyway, so we meet and we have these votes. And that determines what the standard is. A couple of years later, we extended this so it became worldwide. We have standard organizations that are active in Currently fifteen to twenty countries and another 15 to 20 are sort of looking and voting.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  23. Right? Well, I think most people would agree it's better than if I decided it, or better than if a single organization like AT&T decided it.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  24. Met there, we were lectured on the rules of how to do an NC standard. There was about 25 of us there, which apparently was a new record for that kind of meeting. And some of the old sea guys that have been standardizing C was there, so we got some expertise in. So the way this works is that it's an open process. Anybody can sign up if they pay the minimum fee, which is about $1,000 less than a little bit more now. And I think it's $1,280. It's not going to kill you. And we have three meetings a year is fairly standard. We try to meetings a year for a couple of years that didn't work too well. So three, one. Week meetings a year. And you meet and you have technical meeting and then you bring proposals forward for votes. The votes are done one person per

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  25. We really need to get this out in the open. It has to be standardized under formal rules and we are going to standardize it under ISO rules. And you really want to be part of it because basically otherwise we'll do it ourselves. And we know you can do it better. So through a combination of arm twisting and flattery. Got started. So, in late In late 1889, there was a meeting in DC at the, actually, no, it was not ISO then, it was ANSI, the American national standard were doing.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  26. What's the discussion? I'll try and explain that. So sometime in early 1989, Two people, one from IBM, one from HP turned up in my office and told me I would like to standardize C++. This was a new idea to me, and I pointed out that it wasn't finished yet. It wasn't ready for formal standardization and such. And they say, no, Biana, you haven't gotten it. You really want to do this. Our organizations depend on C++. We cannot Depend on something that's owned by another corporation that might be a competitor. Of course we could rely on you, but you might get run over by a bus.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  27. Didn't compile fast enough, was too hard to use and didn't run fast enough unless you had optimizers that was beyond the state of the art. They still are. So we had to do something else. Basically, it was the idea that a set of parameters defines a set of operations and you go through an interaction parable just like for virtual functions. And then you try to optimize the indirection away to get performance. We just couldn't do all of that. But get back to the standardization. We are standardizing C under ISO rules, which are very open process. People come in, there's no requirements for education or experience.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  28. Would have made C11 to CO6 or 07. Well, it turns out that I think we got a lot of the fundamental ideas wrong. There were two conventional. They didn't quite fit C++ in my opinion, didn't serve implicit conversions very well. It didn't serve mixed type arithmetic, mixed type computations very well. Lot of stuff came out of the functional. Community That community. Didn't deal with multiple types in the same way as C does, had more constraints on what you could express and didn't have the draconian performance requirements. And basically we tried, we tried very hard, we had some successes, but it just in the end wasn't.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  29. And neither I nor anybody else at the time knew how to get all three. And I thought for C, I must have the two first. Otherwise, it's not C++. And it bothered me for another couple of decades that I couldn't solve the third one. I mean, I was the one that put... Function argument type checking into C. I know the value of good interfaces. I didn't invent that idea. It's very common. But I did it. And I wanted to do the same for templates, of course, and I couldn't. So it bothered me. Then we tried again 2002, 2003. Cabitos Reis and I started analyzing the problem, explained possible solutions. It was not a complete design. A group in University of Indiana. An old friend of mine. They started a project at Indiana and We thought we could get. Good system of concepts in another two or three years.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  30. 1987, thereabouts when I was designing templates obviously I wanted to express the notion of what is required by a template of its arguments. And so I looked at this. And basically for templates, I wanted three properties. I wanted to be very flexible. It had to be able to express things I couldn't imagine because I know I can't imagine everything and I've been suffering from languages and tried to constrain you to only do what the designer thought good. I didn't want to do that. Secondly, it had to run faster as fast or faster than handwritten code. So basically if I have a vector of t and I take a vector of char, it should run as fast as you build a vector of char yourself without parameterization. And thirdly, I wanted to be able to express the constraints of The documents have proper typecheging of the interfaces.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  31. Concepts. The word concept was used by Alex Stefanov, who is sort of the father of generic programming in the context of C++. There's other places that use that word, but the way we call it generic programming is Alexis. And he called them concepts because he said they're the sort of the fundamental concepts of an area. So they should be called concepts. And we've had concepts all the time. If you look at the KNR book about C, C has aromatic types and it has Integral types, it says so in the book. And then it lists what they are and they have certain properties. The difference to Nay is that we can actually write a concept that will ask a type, are you an integral type? Do you have the properties necessary to be an integral type? Do you have plus minus divide and such?

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  32. And it has the compassion operations. So that's simply the fundamental thing. It's compile time predicates. Do you have the properties I need? So it specifies the requirements of the code on the parameters that it gets. It's very similar to types. Actually

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  33. Basically, what concepts are compile time predicates? They're predicates you can ask, are you a sequence? I have begin and end. Are you a random exit sequence? Yes, I have subscripting and plus. Is your element type something that has a less than? Yes, I have a less than so basically that's the system. And so instead of saying I will take a parameter of any type, it'll say I'll take something that's sortable. And it's well defined. And so you say, okay, you can sort with less than, I don't want less than. I want greater than or something I invent. So you have two parameters, the sortable thing and the compression criteria. And the compassion criteria will say, well, you can write it saying it should operate on the element type.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  34. And this production uses of it. So the basic idea is that when you have a Generic component like a sort function. The sort function will require at least two parameters, one a data structure with a given type and a compression criteria. And these things are related, but obviously you can't compare things if you don't know what the type of things you compare. And so you want to be able to say, I'm going to sort something, and it is to be sortable. What does it mean to be sortable? You look it up in the standard. It has to be a sequence with a beginner and an end. There has to be random access to that sequence, and there has to be the element types has to be comparable by default.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  35. So, yes, it wasn't there. 10 years ago, we have had versions of it that actually work. The last four or five years, it was a design by Gabidos Rays, Drew Sotton and me. We were professors and postdocs in Texas at the time. Implementation by Andrew Soden has been available for that time and it Part of C 20 And this standard library that uses it. So, this is becoming really very real. Available in Klang and GCC, GCC for a couple of years, and I believe Microsoft is soon going to do it. We expect all of C++20 to be available in all the major compilers in 20. But this kind of stuff is available now. Just saying that because otherwise people might think I was talking about science fiction. And so, what I'm going to say is concrete. You can run it today.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  36. That is smaller than the function call because you eliminate the function preamble and return and there's just the operation there. One of the key things when I did Templates I wanted to make sure that if you have say a sort algorithm and you give it a Sorting criteria. If that sorting criteria is simply comparing things with less n, the code generated should be the less than not of indirect function call to a compassion object, which is what it is in the code. We really want down to the single instruction. But anyway, turn off the optimizer and you can debug the first level of debugging. Can be done, and I always do without the optimization on because then I can see what's going on.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  37. The way a really good handcrafted optimizer human could generate it and it was not meant for humans. It was the output of a program and it's much worse today. And with templates, it gets much worse still. So it's hard to combine simple debugging with optimal code because the idea is to drag in information from different parts of the code to generate good code, machine code. And that's not readable. What people often do for debugging is they turn the optimizer off. So you get code that when something in your source code looks like a function core, it is a function core. The optimizer is turned on, it may disappear. The function call, it may inline. And so one of the things you can do is you can actually get code

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  38. Debugging can be truly horrid. Come back to this because I have a solution. Anyway, the debugging was ugly. Code generated by C++ has always been ugly because there's these inherent optimizations. A modern C++ compiler has front end, middle end and back end optimizations. Even C front back end eighty three had front end and back end optimizations. I actually took the code and Generated an internal representation munched that representation to generate good code. So people say it's not a compiler, generate C. The reason it generated C was I wanted to use C's code generator so it was really good at back end optimizations. But I need a front end optimizations and therefore the C I generated was optimized C.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  39. That's right. And furthermore, It gives all the information it's gotten, which is the template, the parameter, and the context of use. Combines the three and generates good code.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  40. So the idea is that you only use virtual functions if you actually need the flexibility. So it's not zero overhead, but it's zero overhead compared to any other way of achieving the flexibility. Now, all to parametrize. compiler looks at At the template, say the vector, and it looks at the Parameter and then combines the two and generates a piece of code that is exactly as if you're written a vector off that specific type. So that's the minimal overhead. If you have many template parameters, you can actually combine code that the compiler couldn't usually see at the same time and therefore get code that is faster than if you had handwritten the stuff. On this, you are very, very clever.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  41. It's close to optimal, it's endu is obvious. It turned out the simula had a more complicated way of doing it and therefore slower. And it turns out that most languages have something that's a little bit more complicated, sometimes more flexible, but you pay for it. And one of the strengths of C was that you could actually do this object oriented stuff and your overhead compared to ordinary functions. There's no indirection. It's sort of in 5, 10, 25% for just the core. It's down there. It's not two. And that means you can afford to use it. Furthermore, in C, you have the distinction between a virtual function and an unvirtual function. If you don't know what any overhead, if you don't need the, that gives you the flexibility in object-oriented programming, just don't ask for it.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  42. Do metaprogramming also. I didn't go there in that explanation. We're trying to be very basic, but go back on to the implementation. You couldn't implement this efficiently, if you couldn't use it. so that it became efficient, it has no place in C because it will violate the zero overhead principle. So when I had to get object running programming inheritance i took the idea of virtual functions from simula Virtual functions is a similar term. Class is a similar term. If you ever use those words, say thanks to Krishna Yugo and Olio and Dal. And I did the simplest implementation I knew of, which was basically a jump table. So you get the virtual function table, the function goes in, does an indirection through a table and get the right function. That's how you pick the right thing there. And I thought that was trivial.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  43. Fortune gave us the vector called a ray of doubles. But the minute you have a vector of doubles, you want a vector of double precision doubles and for short doubles, for graphics, and why should you not have a vector of integers while you are at it or a vector of vectors or chess pieces now you have a board? This is you express the commonality as the idea of a vector and the variations come through parameterization. And so here we get the two fundamental Similarities of Types in C. There's the inheritance and there's a parameterization, there's the object oriented programming, and there's the generic programming.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  44. So, what people found was that you don't actually No, how do I say this? Lot of types are related. That is, the vehicles, all vehicles are related bicycles, cars, fire engines, tanks. They have some things in common and some things that differ. And you would like to have the common things common and having the differences specific and when you didn't want to know about the differences like just turn left, you don't have to worry about it. That's how you get the traditional object-oriented programming coming out of Simula adopted by small talk and C++ and all the other languages. The other kind of obvious similarity between types comes when you have something like a vector.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  45. You can choose exactly like an integer and run just as fast as an integer. The SC ideal right there. And of course you probably don't want to use the int itself, but it has happened. People have wanted integers that were range checked so that you couldn't overflow and such, especially for very safety critical applications like the fuel injection for a marine diesel engine for the largest ships. This is a real example, by the way. This has been done. They built themselves an integer that was just like integer except that it couldn't overflow. If there was an overflow, you went into the error handling. And then you built more interesting types. You can build a matrix, which you need to do graphics, or you could build a gnome for a For a video game.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  46. And, well, I had lunch with Dennis most days for 16 years, and we never had a harsh word between us. So these C versus C++ fights are for people who don't quite understand what's going on. Then the other part is the abstraction. And the key is the class, which is a user-defined type. And my idea for the class is that you should be able to build a type that's just like the build-in types. In the way you use them, in the way you declare them, in the way you get the memory, and you can do just as well. In C process You should be able to build an abstraction, a class which we can call capital int.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  47. Let's first get a principle or an aim in place. C++ is for people who want to use hardware really well and then manage the complexity of doing that through abstraction. And so the first facility you have is a way of manipulating the machines at a fairly low level. That looks very much like C. It has loops, it has variables, it has pointers, like machine addresses, it can access memory directly, it can allocate stuff in the absolute minimum of space needed on the machine. There's a machine facing part of C++, which is roughly equivalent to C. I said C++ could beat C and it can. Doesn't mean I dislike C. If I disliked C, I wouldn't have Furthermore, after Dennis Richie, I'm probably the major contributor to modern sea.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  48. Sooner or later somebody is going to try again. There has been attempts to write new C++ compilers and some of them has been used and some of them has been absorbed into others and such. Yeah, it'll happen.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  49. And so having a single implementation was never an option. Now, I also happen to dislike monocultures They are dangerous Because whoever owns the monoculture can go stale and there's no competition and there's no incentive to innovate, there's a lot of incentive to put barriers in the way of change because, hey, we own the world and it's a very comfortable world for us. And who are you to mess with that? So I really am very happy that there's four front ends for C. Great, but GC was great, but then it got somewhat stale. Clang came along, and GC's much better now. Microsoft is much better now. So at least a low number of front end puts a lot of pressure on Standards compliance and also on performance and error messages and compile time speed, all this good stuff that we want.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source

  50. Not to start, but many operating systems. The whole world was not an 86 and a Linux box or something, whatever is the standard today. In the old days, they set a backs. So basically, I assumed there would be lots of compilers. It was not a decision that there should be many compilers. It was just a fact. That's the way the world is. Yes. Many compilers emerged, and today there's Least four front ends, Clang, GCC, Microsoft, and EGG, it is design group. They supply a lot of the independent Organizations and the embedded systems industry. And there's lots and lots of backends. We have to think about how many dozen backends there are. Because different machines have different things, especially in an embedded world, their machines are very different. The architectures are very different.

    2019-11-07 · Lex Fridman Podcast · Bjarne Stroustrup: C++ · IDENTIFIED FROM THE TRANSCRIPT · source