CppCast - Modern C++ for the Windows Runtime

Episode Date: May 20, 2015

Rob and Jason are joined by Kenny Kerr to talk about Modern C++ for the Windows Runtime. Kenny also shares his thoughts on printf and tells us about his new Pluralsight course. Kenny Kerr is a... computer programmer and recognized expert in Windows operating system development and programming languages. Kenny has published numerous articles about the Windows operating system, network security, and C++ for MSDN Magazine as well as other publications. Microsoft has recognized Kenny’s expertise in network and operating system security with the Microsoft MVP Award for security. He has also held the Microsoft MVP Award since 2007 for his contributions to the C++ development community. News Thoughts about C++17 (Bjarne Stroustrup) C++17 progress update HPX and the C++ Standard Kenny Kerr @kennykerr Kenny Kerr's Blog Links Modern C++ for the Windows Runtime SQLite with Modern C++ (Free Pluralsight Course) Kenny Kerr's Pluralsight courses Sponsors

Transcript
Discussion (0)
Starting point is 00:00:00 This episode of CppCast is sponsored by JetBrains, maker of excellent C++ developer tools. Listen in for a special discount code later this episode. And by CppCon, the annual week-long face-to-face gathering for the entire C++ community. The call for CppCon 2015 submissions is now open with a deadline of May 22nd. Episode 12 of CppCast with guest Kenny Kerr, recorded May 20th, 2015. In this episode, we discuss some C++17 news. Then we'll interview Kenny Kerr about modern C++ for the Windows runtime. Kenny will also share his thoughts on Printf and tell us about his new Pluralsight course.
Starting point is 00:01:25 Welcome to episode 12 of CppCast, the only podcast for C++ developers by C++ developers. I'm your host, Rob Irving, joined by my co-host, Jason Turner. How are you doing tonight, Jason? Doing great, Rob. I had a great week at CppNow. How are you doing? I'm doing pretty well. So how was the conference, exactly? Did you have a good time? How were your sessions? It was good. My sessions were nerve-wracking, but I think at least one of them was well-received. And some great keynotes and some great talks there. I learned a lot.
Starting point is 00:01:51 Who did the keynotes, by the way? Oh, there were four keynotes. There was... Oh my goodness, I wasn't expecting that question. There was Eric Niebler's keynote on ranges, there was andrew sutter's keynote on concepts and there was a keynote on um on weather prediction i believe he has three keynotes that's right okay yeah and you actually tweeted that uh john kalb actually gave the podcast a shout out before eric niebler's keynote is that right? Yeah, that was awesome. He just made sure everyone in the room was aware of the podcast before we started the keynote. He said, so who has a greater than an hour drive back home? And everyone raised their hands and he's like, okay, go download some podcasts before you leave. That's awesome. Well, so hopefully we have some
Starting point is 00:02:43 new listeners who are there at uh c++ now so you know thanks for coming to the show this is episode 12 there's you know 11 episodes of content you can go and listen to so go check it out and uh there will be plenty more to come so usually i like to read a piece of feedback but i don't think i have any this week. But if you would ever like to share your thoughts about the show, just email us at feedback at cppcast.com. So joining us today is Kenny Kerr. Kenny is a computer programmer and recognized expert in Windows operating system development and programming languages. Kenny has published numerous articles about the Windows operating system, network security, and C++ for MSDN Magazine, as well as other publications. Microsoft has recognized Kenny's expertise in network and operating system security with the Microsoft MVP Award for Security.
Starting point is 00:03:34 He has also held the Microsoft MVP Award since 2007 for his contributions to the C++ development community. How are you doing, Kenny? Welcome to the show. Hi, Rob. Thanks for having me. That's quite a bio you have. Yeah, it's just a bunch of words. It doesn't mean much. I'm just a guy who likes to program in C++. There you go. So I wanted to go over a couple news items today before we get into the interview. The first one is Bjorn Strusup released this article with his thoughts about C++17,
Starting point is 00:04:08 and he posted it to the ISO CPP blog. So this was pretty interesting to see because he kind of outlined his thoughts about what C++17 is going to be, what that means, and kind of some of the specific goals that he hopes the committee is going to be able to meet and get into C++17. Did either of you guys have a chance to read through this? It was a pretty long article, but it was a good read. Yeah, it was interesting.
Starting point is 00:04:38 It's good to get a reminder of where things have come from and where things are going. It's good to see that things are accelerating now. It was a long stretch from C++98 to C++11. It's good to see that they're working. Sometimes the releases are actually too big. I think C++11 had too much
Starting point is 00:04:58 in it, but for the most part, it's all good and it's good to see everyone getting excited about it again. Yeah, definitely. In here, he actually put in his top 10 list of C++ 17 features that he would like to see make it, and
Starting point is 00:05:14 that includes concepts, modules, ranges, uniform call syntax, coroutines, networking support, contracts, SIMD vectors, and library vocabulary types, and he actually put coroutines in here twice, so I guess he's really excited about coroutines.
Starting point is 00:05:30 Yeah. Jason, you have any thoughts on this? Oh, sorry, Kenny. No, no, go ahead, Jason. You know, I am looking forward to coroutines. I think that'll be interesting, although I still don't really have a full grasp on how to use them since I'm mostly a C++ guy and we don't have coroutines yet. And modules, I'm interested to see how that
Starting point is 00:05:49 plays out. But I'm definitely looking forward to see what gets into it. Yeah. Yeah, the work for coroutines actually comes from the Visual C++ team. Jim Radigan and Gor Nishinov have been working very hard to implement what they call resumable functions, which is really true coroutines for C++, which is pretty exciting. And the way they've actually got it implemented and the way it scales, it's quite staggering. So I'm really excited to see that come to release.
Starting point is 00:06:19 I'm not sure that it'll actually be released as part of the RTM for 2015, but there is a preview, at least, in the compiler that you can use today. So it is very cool that you can actually start playing with it. That is interesting. It's already available now, right? I think it's like a header library that you can use for coroutines? No, no, there's actual runtime and compiler support for this.
Starting point is 00:06:41 So it's more than just a library. It has to be more than just a library because coroutines are really fundamentally different to the way the C stack-based call system works. So they've had to do a lot of work behind the scenes, certainly in the back end. That's why guys like Jim Radigan are involved, but also in the front end.
Starting point is 00:07:02 So it actually has a really neat way of integrating with your own type system so you can have these modern hooks into resumption and waiting and so on. And so it's really neat to see that coming together. But as I said, they're still working on it. The build that I have right now only supports x64. Hopefully for RTM they'll have the other flavors as well, but I'm not even sure whether it'll actually be production ready. We'll have to see how it shapes out for the
Starting point is 00:07:32 RTM. For anyone interested, Gore actually gave a talk at C++ Now about coroutines and hopefully that'll end up live for everyone to watch on the internet here shortly. That's good. Yeah, all the C++ Now talks from last year were eventually made online on YouTube, I believe, right? Yes, or at least most of them. Okay. So the next article, this is actually just a post on Reddit from STL, and it's about C++ Standards Committee just had their meeting in May, or earlier this May. And they just have a summary here of some of the different features for C++ 17 that got approved. So not that different from the other article
Starting point is 00:08:20 we were talking about, but he went over various technical specifications that were published. He said that zero core features were approved, but not to freak out about it too much, they're still working on modules and concepts according to STL, but it's nice to see an update coming in from him. Yeah.
Starting point is 00:08:42 I think the biggest, not danger perhaps, but the concern I have with these more exciting releases of C++, all these new versions, is that there's a tendency to put, how would I describe it, perhaps basic implementations in the standard. And I'm putting basic here in quotes. So something like the existing standard thread or a networking stack or a graphic stack. Folks really want to have these things in their standards
Starting point is 00:09:12 so that we can go to university and say, hey, yeah, yeah, we also do that. We like a Me Too feature. And the challenge is that it's often a minimal subset or a common denominator feature. And it isn't actually true to the roots of C++. If you ask Stroustrup what is C++ all about, he'll say it's all about having a direct mapping to hardware and having zero
Starting point is 00:09:35 overhead features. And that often doesn't translate well to these basic implementations because there's often just not a great mapping to the graphics platform on Apple or Windows or whatever. And the networking stack isn't quite optimized for say IO completion ports on Windows or whatever you have on Linux. So it's nice to see these things in there, but it's also a little bit,
Starting point is 00:10:00 I'd be a little bit cautious because it's often just a very basic implementation, which doesn't always help. Yeah, and if it's too basic, then no one's going to actually use it. They're just going to continue using whatever they have now, probably. Right, right. And it makes the standard more complex. It makes it harder for implementers as well. So I don't know.
Starting point is 00:10:21 Just my two cents. Okay. And this next article comes from Hartmut Kaiser, who was a guest a couple episodes ago. And he's also giving his update about new C++17 technical specifications on parallelism and concurrency. And this was pretty interesting to read, that it looks like parallelism will be kind of a a feature built into c++ 17 which would be very nice to have yeah concurrency is probably the biggest uh new addition here i think um that i'm really hoping to see anyway certainly the work i mentioned uh that uh that we talked about already about co-routines or resumable functions. There's also, you guys know Artur Lexberg and Niklas Gustafsson. Again, two developers in the Visual C++ team.
Starting point is 00:11:12 They've been working on the concurrency runtime for Visual C++. And on that concurrency runtime, they built the PPL, which is the Parallel Patterns Library, and the TOSC Library. And all of that stuff is now getting fed back into the standard to improve things like the features library. So it's getting far more mature. So today we have features in C++11, but you have to wait in it or you have to get, and it's blocking.
Starting point is 00:11:35 So they introduced the concept of chaining tasks and chaining activities. And that really opens up the sort of concurrency and scalability of that feature so a lot of that is sort of round tripping back into the standard which is great to see and of course is the um the parallel stl algorithms which may also make it in which would be great yeah also for anyone who's interested there was uh several talks by people related to hpx and the stellar group about parallelizing the STL and other talks related to this that, again, should be coming online at some point here. Very cool. So, moving on to you, Kenny. We actually both attended a different conference.
Starting point is 00:12:19 We were both at Microsoft's Build conference this year, and we attended a lot of the same talks. Basically, any talk with C++ in the name, I think we were both there. But we never got a chance to run into each other, which was unfortunate. But I wanted to know, what were your thoughts on the conference? Yeah, it was an interesting conference.
Starting point is 00:12:39 I haven't been to a conference in a while, so it was fun to attend. Mostly for me, it's fun to just bump into people and have conversations that you would otherwise not have. But yeah, there were some interesting sessions. I really enjoyed James Clark. He had a session on Windows Composition. I don't know if you saw that one.
Starting point is 00:12:55 Yeah. He was introducing the new Composition API, which is sort of the evolution of Direct Composition, but in the Windows runtime platform. And that becomes part of the new Universal Windows platform. And so that was really cool to see. The work they're doing is pretty amazing. And, yeah.
Starting point is 00:13:17 Do you have any thoughts about the Universal Windows app story as it relates to C++ developers? Oh, that's a big story. Sure. Well, I mean, this is one of the challenges I'm having today with how do we as C++ developers address this? How do we as C++ developers
Starting point is 00:13:39 target the universal Windows platform, this environment, which is really the future of the Windows API, but for which there's no real strong support for C++. Technically, there is C++ CX, but this isn't standard C++. This is a bunch of extensions, and there are various challenges with that.
Starting point is 00:14:04 I mean, I could talk at length about that, but I'm not sure if you guys are into that. Well, let's go into C++ CX a little bit because it is something I'm familiar with. It's something I've worked with because I'm a mobile app developer. But I would wager that most of our guests are probably, or most of our listeners are not familiar with C++ CX. Do you want to tell us a little bit about what it is and how it's used in app development? Sure. Well, okay. So C++ CX is a set of language extensions in the Visual C++ compiler in order to both consume and author Windows runtime types.
Starting point is 00:14:39 So it really does two things. Firstly, it provides language support for COM. And second, it provides compiler support for COM, and second, it provides compiler support for consuming and producing Windows runtime metadata, the WinMD files that describe the types within a WinRT component. But there's a problem here. So C++ is a language for library developers. The library developer's job may not be a simple one, but you certainly have the tools at your disposal to do some amazing things. So when you hit some feature that isn't directly supported in the language, you write a library. You don't go and invent a new language or write a set of language extensions.
Starting point is 00:15:13 Now, prior to C++11, you could be forgiven for thinking in this way, but not now, right? We have C++14. We've come a long, long way from those days. But this goes really further back than that. So back with.NET, there was a time where.NET was all the rage at Microsoft. Even in the C++ team, they started thinking that they should be the number one compiler for producing managed code. And it's during that time where they invented the C++ CLI. And that was another language extension for targeting the.NET framework or the common language runtime.
Starting point is 00:15:49 And that's the garbage collected runtime at the heart of.NET. But just as quickly as C++ CLI appeared, the C++ team realized that their focus really should be on native code, and rightly so. So the team has been working ever since on improving their support for standard or ISO C++ and things like in the concurrency runtime we mentioned and standard libraries and the CRT. And that's all great stuff. And Charles Torrey from Channel 9, he did a lot of work to promote that C++ renaissance.
Starting point is 00:16:20 But when Windows 8 happened, we had the Windows runtime that came alive. And rather than looking at the future of C++ and seeing how standard C++ is more than able to make Visual C++ the number one compiler for targeting this new platform, they instead just dragged C++ CLI out of the closet, so to speak, dusted it off, and now we have this unnecessarily complex way to work with the Windows runtime, with a syntax that made some sense for a garbage-collected runtime like.NET, but really makes no sense for COM and the Windows runtime. And I'm not trying to belittle the work they did there. They did a lot of incredible work
Starting point is 00:16:55 getting that to come alive, but it just doesn't have the right... It just doesn't make the right connection with the Windows runtime. It certainly doesn't grab the mind share in the hearts of C++ developers who are really passionate about C++ and the future of C++. It's something on the side. I almost wonder if part of what they're trying to do was to make C++ seem more approachable to a C Sharp developer
Starting point is 00:17:22 because C++ CX and C++ to CLI, it interops really well with C-sharp, and it could be a more familiar interface for that type of developer. Well, okay, but no, the interop you're speaking of is provided by WinRT, right? It's not CX.
Starting point is 00:17:41 CX is just the language projection which we're given to use with the C++ compiler in order to do that consumption and production of types. You could get that interop with any language, and certainly you can get it with standard C++. So the power doesn't come from CX. CX is the way you describe those types, and arguably that description is overly complicated.
Starting point is 00:18:05 It doesn't draw you closer to C Sharp, and it doesn't even look anything like C Sharp. Whereas if you had to adopt something that is based on modern C++, standard ISO C++, you actually find something that looks a lot more like C Sharp. And it's a lot more appealing to the C Sharp developer because it's actually simpler. There's no hats,
Starting point is 00:18:31 there's no pointer semantics, all this stuff that comes up with the C++ CX that goes away because that's not really part of modern C++. That's stuff that belongs in the library. Right. Well, do you want to talk about the library that you've worked on, modern C++, that helps get around this problem? Sure, yeah. I mean, I've been working on a project now for over a year called Modern C++ for the Windows Runtime. It gets kind of confusing online and on the web and if you do Google searches
Starting point is 00:18:55 because modern C++ is a thing in itself, not like a standard thing like C++ 14, but it's something that a lot of people talk about. They talk about modern C++, and I do. I talk about modern C++ for SQLite or for concurrency, for other things. But I needed a name for this thing that is specifically for the Windows runtime, and this is what I've called it. But it's more than just what most people assume.
Starting point is 00:19:20 It's just a bunch of wrappers for the WinRT types and so on, but it's a lot more than that it's really two things there's a compiler and there's a library the library itself is a header only library designed to provide standard C++ developers with first class access to the universal Windows platform
Starting point is 00:19:38 to the future of the Windows API based on the Windows runtime with its roots in com rather than.NET so the library itself, it amounts to around 320,000 lines of, or non-blank lines of code, but only about 3,000 or 4,000 of that is handcrafted. Oh, okay. The rest is generated by the modern compiler.
Starting point is 00:20:00 So that's where the compiler comes in. So it's not just a hitter. It's a compiler and a library. The compiler parses the Windows API and converts all the API surface area, the types, interfaces, classes and so on into a form that is optimized for the C++ compiler. This opens the door to modern or generic metaprogramming for C++. This is very sort of this is a very different way of looking at it than
Starting point is 00:20:26 most of the language projections which are all based on metadata which is all rooted in.NET. This is very much a system that is geared towards the compile time programming with C++. So the compiler does all of this work of translating the API. Yeah, it's been quite an interesting experience. And what I have now is something that provides better performance than C++ CX. And it is a lot simpler even than using C Sharp in many cases, because of the fact that C++ is far better at managing the Windows runtime than C Sharp is, because it's a at managing the Windows runtime than C Sharp is because it's a completely different runtime.
Starting point is 00:21:07 Interesting. So you've actually done performance benchmarks and shown that if you're writing an application using modern C++, it'll perform better than using C++ CX. Yes. Very cool. That's pretty amazing.
Starting point is 00:21:21 No, no, but no, don't misunderstand what I'm saying here. I am sort of standing on the shoulders of giants here, right? What I still rely on is the Visual C++ compiler, right? I'm still relying on the state-of-the-art compiler for standard C++. And that's really where they're putting all their energy. They're improving the standard C++ compiler. And I'm getting that for free. Right, right.
Starting point is 00:21:47 Whereas C++ CX is really on the side. And, you know, I don't know how it works under the covers. They may not get all the same optimizations or whatever else. And it may just not be where they're investing their time. But as a library developer, I get to make the most of standard C++. And as the language improves, so does my library as the compiler improves. So does my library. And so I think it's a win for everyone. Now I've, uh, I've heard of the things that you're talking about, like C++, CX, but I've never had to use them. So I'm a little bit of an outsider on this.
Starting point is 00:22:22 And I've, I'm curious when you say that your compiler parses the windows API, what exactly do you mean? Are you parsing the windows header files from Microsoft or are you talking to the comm interop system and querying the interfaces? How are you getting that information? Right. So that's a good question. So, so most of the language projections, what they'll do is they'll consume the WinMD files. The WinMD files describe the types for an API or for a component in a way that is very natural to manage code. It uses the same metadata format that the.NET Framework did. And this is very much a byproduct of whatever language projection you use, the compiler or the tooling you have will emit this WinMD file which describes it.
Starting point is 00:23:08 And it's kind of like the de facto standard way of describing a component's type system. However, in actual fact, it's not how those types tend to be described. If you look at the way the operating system is built, they don't author WinMD files, they will author IDL files. And this is just your traditional IDL files that we had in ClassicCom with some new attributes and keywords built in that now help you to describe WinRT types rather than ClassicCom or RPC types. And so what the modern compiler does is it parses all of the IDL files that are part of the Windows SDK.
Starting point is 00:23:50 And then rather than projecting that into WinMD, which is really a metadata format which is geared towards managed code or the CLR, it takes that same IDL sources and generates C++ code, which is geared for the C++ compiler. So the projection is entirely different. The types are often very different.
Starting point is 00:24:12 And it's a much more natural model for a C++ compiler to not consume than it is for a C++ compiler to try and consume 1MD files. Interesting. So these are just generic IDLs that are available to anyone who has the SDK. And if you, hypothetically, if you wanted to, you could parse them and expose
Starting point is 00:24:34 it to Ruby or Python or whatever else you wanted to. You could, yeah. A lot of those sort of more reflective languages might be better served with WinMD. Sure.
Starting point is 00:24:50 But certainly if you're doing a compile-time language, if you're doing something in C or C++, having something in IDL, that's a far more lower-level way of looking at the APIs because it's very much closer to the ABI, the binary interface for the APIs, because it's very much closer to the ABI, the binary interface for the components, which translates better for C++ because we can set up our V tables,
Starting point is 00:25:12 we can manage inheritance and composition, and so on much more naturally. Right, okay. I want to interrupt this discussion for just a minute to talk about this special offer that JetBrains has made for CppCast listeners. JetBrains makes some awesome tools for C++ developers in any environment.
Starting point is 00:25:34 There is the ReSharper C++ plugin for Visual Studio developers, AppCode if you're working on iOS or OSX apps, or their new cross-platform C++ IDE, C-Line, which runs on Linux, Windows, and OSX. JetBrains is offering a coupon code which can be used to get a personal license to any of those tools for 25% off. The code is cppcast jetbrains cpptool. All one word, just enter that code during checkout where it prompts you for the discount code. Again, that's CppCast, JetBrains, CppTool, which will get you 25% off any of the JetBrains C++ tools, C-Line, AppCode, or ReSharper
Starting point is 00:26:13 C++. JetBrains has extended this offer to CppCast listeners until June 30th, so head to JetBrains.com slash Cpp and take advantage of this great offer. Okay. Do you want to maybe move on and talk about some of your recent Pluralsight courses? You've done a number of Pluralsight courses on various C++ topics. Yeah, yeah. I think I've just finished my 12th course this year. I never imagined I would do these courses.
Starting point is 00:26:47 It's a huge amount of work, but it turned out to be quite a lot of fun. And what's this latest course on? The latest course is called SQLite with Modern C++. And it's taking the incredible little database engine called SQLite, which is all implemented in C, the C programming language, and provides a C-style API and making it really a joy to use from modern C++. So doing all the resource management and the error handling and projecting that all into a type system that is much more natural to use as a C++ developer and a lot more productive. So you get to see the whole experience of learning how the SQLite API works, everything from downloading it,
Starting point is 00:27:25 building it, using the C API, and then starting to do the projection into modern C++. How do you manage resources, databases, connections, statements, and so on, and how the SQL concepts are exposed in SQLite as an engine. And some of the unique features, you get to learn quite a lot about that. Okay, very cool. And you just announced today that this course is actually going to be free for the next week. Is that right? That's right. I think until the 26th, it'll be free online from Pluralsight.
Starting point is 00:28:05 I think we're going to have a link for that on the show, perhaps. Yeah, we'll absolutely get a link in the show notes. And yeah, so if you don't have a Pluralsight subscription, you can certainly go and watch it for free this whole week. If you do have a subscription, it's available to you already, so that's fine. But yeah, it will be free for anyone who would like to go and check it out. Awesome. And Pluralsight subscription is usually, I think, $20 or $30 a month. So to be able to see one of these courses completely for free and kind of check it out, see what Pluralsight's all about is definitely worth doing.
Starting point is 00:28:36 And there's now a growing collection of C++ courses. So if you're a C++ developer, there's quite a lot there now for you guys as well. Yeah, I know you obviously have several courses, and I think Kate Gregory is another person who's made several C++ courses on Pluralsight, right? Yeah, that's right. Very cool. So I recently read the article that you published a few months ago in defense of printf, and it seemed like you caused a little bit of a stir there
Starting point is 00:29:06 if you read the comments on your website. Yeah. Let's start with why did you feel the need to defend printf? Well, okay, so C++ obviously inherited printf from C, the C programming language. And C++ has for a very long time had this stream-based IO library, which is just this huge and costly abstraction that has no resemblance to the beauty and efficiency
Starting point is 00:29:31 of the standard template library that Alexander Stepanov has blessed us with. Now, Printf has its issues, right? It can be dangerous to use. It has a very brittle type system, so to speak. But its performance is just incredible. And nothing else has come close. So I've always tended to use it because I favor performance over pretty much everything else.
Starting point is 00:29:58 But there's been quite a backlash in terms of people. Excuse me. Sorry, I just needed a quick drink there. It's okay. There's been quite a backlash because a lot of people, especially educators, want to say that Printf is old school and it's for C developers,
Starting point is 00:30:17 and C++ developers really should be using something modern and something higher level. But the reality is I Streams is not modern. It's as old as the hills. And unfortunately, the performance of it is really, really bad. And that's inherent to its design. There's nothing you can really do about it. It's rooted in enormous amounts of virtual function calls.
Starting point is 00:30:41 There's not all that much you can do about it. But whereas Printf is very, very, very fast. And so this has sort of been the trade-offs we've had up till now, and there's really nothing you can do about it. You choose the one or the other, and you make your trade-offs, and off you go. However, with C++11, we had this lovely thing called variadic templates. And I'm sure you guys have all played with that. And you go online and there's all these guys doing incredible stuff with variadic templates. So I thought, well, why can't we take variadic templates and do all the type safety with variadic templates? So doing all the same
Starting point is 00:31:19 checking, giving you all the same assurances that what you're doing is correct, but doing those checks at compile time rather than runtime. And then having the compiled code have the same performance characteristics as printf. And so if you look in, I think it's the May 2015 issue of MSDN Magazine, there you see my most ambitious example of this. And you really get to see that all coming to life. And I've done some performance work. And in fact, the modern compiler uses this implementation internally to do all of its code generation. And I've been able to match the performance of Printf, but using a library that provides all of the type safety of IO streams. Interesting. So have you released this library publicly by itself or not? I haven't as
Starting point is 00:32:07 a library. If you look at the article, you can sort of piece it together from all of the code snippets. Okay. I could release it, I suppose. I haven't had a whole lot more interest on it. There's just so much backlash against Printf. I suspect people just want to stay away from it. You could really if you care about performance and if you care about io performance you really should think about it well you know i'm sorry go ahead no no go ahead well i think you know kind of just to reinforce your your point here is the whole std uh end line controversy if you will and i even noticed it in one of the comments on your
Starting point is 00:32:46 InDefensive Printf posting that someone who was comparing the performance of cout to printf was doing end lines instead of doing a new line, which an end line, for those who don't know, is flushing the buffer on every single call instead of just putting a new line like you need to. And that has huge performance problems on some platforms.
Starting point is 00:33:09 That's right, that's right. It's a C-out, even at its best, is still misunderstood, I guess is what I'm trying to say. Yeah, yeah. No, I mean, you could do a lot better with C-out in terms of things like that. And, you know, at the end of the day, most people use C-out for, you know, console the end of the day, most people you see out for, you know, console
Starting point is 00:33:25 apps where that kind of performance doesn't really matter. Right. But if you're doing something like generating reports on a server or doing code generation, that performance really counts. You know, like with a modern library, a modern compiler generates three, four hundred thousand lines of code. I can do that in a few seconds. With IO streams. It would take me minutes, literally minutes. So that really matters for some scenarios. This might be just a little off topic, but you say in your article that you're
Starting point is 00:33:58 trying to get to the root of just how old C-OUT is a couple people comment that they saw references back to it back to 1985 i believe it was so that would means that it predates the stl is that correct did you ever come to a conclusion as to who how old it was who it was designed by or anything like that uh some guy sent me a photograph of a page from a reference manual, I think that went back to 1981. 1981, okay. Yeah, where they had actually references to that library there. So this predates, you know, that's long before I even looked at C++. So Strewstrip himself might have been the one to design and implement this.
Starting point is 00:34:41 I don't know. I don't know where it came from. Okay. But, yeah, it's interesting. Interesting, yes. I don't know I don't know where it came from but yeah it's interesting interesting yes I'm curious now about the full history but that's kind of irrelevant
Starting point is 00:34:54 I guess really okay well is there anything else you want to talk about with us today Kenny before we let you go no I think that's about it thanks for having me It's been great chatting with you guys. Yeah, it's been great having you. And again, everyone
Starting point is 00:35:09 listening, definitely go check out SQLite with Martin C++ on Pluralsight. You usually would have to pay $20 or $30 a month to check this out, so it's always nice to see what this is like for free. I'm sure it's a great course. I'll have to go watch it myself.
Starting point is 00:35:26 And Kenny, where can people find you online? You can find me at kennycurr.ca. I live in Canada, so it's.ca rather than.com. And if you're looking for Modern C++, it's moderncpp.com. Oh, and on Twitter, you can follow me at kennyker very cool well thank you so much for your time Kenny thanks guys thank you
Starting point is 00:35:51 thanks so much for listening as we chat about C++ I'd love to hear what you think of the podcast please let me know if we're discussing the stuff you're interested in or if you have a suggestion for a topic I'd love to hear that also you can email all your thoughts to feedback at cppcast.com. I'd also appreciate if you can follow CppCast on Twitter and like CppCast on Facebook. And of course, you can find all that
Starting point is 00:36:15 info and the show notes on the podcast website at cppcast.com. Theme music for this episode is provided by podcastthemes.com.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.