CppCast - Linear Algebra and Audio

Episode Date: April 11, 2019

Rob and Jason are joined by Guy Davidson to talk about his work with the ISO C++ committee including proposals for a linear algebra library and audio api. Guy Davidson is the Principal Coding ...Manager of Creative Assembly, makers of the Total War franchise, Alien: Isolation and Halo Wars 2, Guy has been writing games since the early 1980s. He is now also a contributor to SG14, the study group devoted to low latency, real time requirements, and performance/efficiency especially for Games, Financial/Banking, and Simulations, and to SG13, the HMI study group. He speaks at schools, colleges and universities about programming and likes to help good programmers become better programmers. News NFHTTP a cross platform C++ HTTP library Understanding C++ Modules part 2 Blend2D - 2D Vector Graphics Powered by a JIT Compiler C++ Lambda Story Free Ebook Guy Davidson @hatcat01 Links linear.algebra - A proposal to add linear algebra support to the C++ standard library A Standard Audio API for C++:Motivation, Scope, and Basic Design CppCon 2018: Guy Davidson "Lightweight 2D graphics with io2d" Sponsors Backtrace Announcing Visual Studio Extension - Integrated Crash Reporting in 5 Minutes Hosts @robwirving @lefticus

Transcript
Discussion (0)
Starting point is 00:00:00 Thank you. and gaming platforms. Check out their new Visual Studio extension for C++ and claim a free trial at backtrace.io. In this episode, we discuss some new open source libraries. Then we talk to Guy Davidson. Guy tells us about his work with the ISO committee, including new proposals for an audio API. Welcome to episode 194 of CppCast, the first podcast for C++ developers by C++ developers. I'm your host, Rob Irving,ined by my co-host, Jason Turner. Jason, how's it going today? I'm all right. How are you doing, Rob?
Starting point is 00:01:31 I'm doing okay. I'm feeling a little bit better than I was an hour ago. That's good. Yeah, yeah. Episode 194. It sounds like we're getting perilously close to episode 200. We are getting very close to 200. That's just six weeks away now. I don't know what we're going to do because we obviously
Starting point is 00:01:50 did a pretty special guest with episode 100 where we had Bjarne come on. I don't know what we should try to do for 200. I don't know. I guess if anyone has any suggestions, let us know. Okay. Well, to top your episode, I'd for episode like three piece of feedback
Starting point is 00:02:05 we got this tweet from david pool and he's saying the c++ committee deprecated code cvt in 2017 leaving c++ with no standard way to handle unicode could you bring in some smart people to talk about our alternatives and thanks for the podcast and he linked paper, which is deprecating code CVT, which I'll be honest with, I was not familiar with this at all. Jason, were you? I knew that that happened, but I'd completely forgotten. Like so completely that I actually recently deployed some code that uses code CVT.
Starting point is 00:02:40 Oh, really? Yes. Well, I mean, it sounds like the reason they're deprecating it is because they thought no one was using it. Well, I mean, if you needed, without making an operating system call, some way of converting between, you know, 16-bit wide whatever Unicode, like, it was there. Right. So are you not happy with them for taking this out? I honestly don't know enough about it.
Starting point is 00:03:04 No, I mean, well mean well i mean there's libraries that have been around since the beginning of time since the beginning of unicode to handle this kind of thing what's that we're in a really popular one from a really well really complete one from ibm i think does anyone know what i'm talking about i don't guy do you know what we're talking about uh Are you talking about ICU? Yes, that one. That's by the Unicode Consortium, isn't it? Is it?
Starting point is 00:03:31 Yes, I don't know. I don't have to deal with it often enough, but I was helping move some code away from Qt, which was relying on that, basically. So I used code CBT. Okay. Well, we'd love to hear your thoughts about the show as well. You can always reach out to us on Facebook, Twitter, or email us at feedback at code CBT. Okay. Well, we'd love to hear your thoughts about the show as well. You can always reach out
Starting point is 00:03:45 to us on Facebook, Twitter, or email us at feedback at cbcast.com and don't forget to leave us a review on iTunes. Joining us today, you just heard him, is Guy Davidson. Guy is the Principal Coding Manager of Creative Assembly, makers of the Total War franchise, Alien Isolation,
Starting point is 00:04:01 and Halo Wars 2. Guy has been writing games since the early 1980s. He is now a contributor to SG14, the study group devoted to low latency, real-time requirements, and performance and efficiency, especially for games, finance, banking, and simulations. And to SG13, the HMI study group, he speaks at schools, colleges, and universities about programming and likes to help good programmers become better programmers. Guy, welcome back to the show. Hi, Japs. Good to be back again.
Starting point is 00:04:29 I think it's my third visit now, isn't it? Yeah, I think we have had you on two times before. I like, I'm sorry, just the fact that you said 1980s instead of 80s, Rob, as you read the bio. Just to clarify, Guy is not old enough to have been writing games in the 1880s i don't think anyone was writing games in the 1880s no but i did just see someone on twitter complaining like someone went up to her and it's like oh have you heard about this movie and i forget the name of the movie so i'm just gonna use mean girls as an example uh have you heard about this movie mean it was made in the 1900s oh no yeah that's so last century isn't it yeah that's like that's technically true but no just don't go there just don't stop what was this young person i have no
Starting point is 00:05:17 idea oh dear wow i'm 51 you know it's like yesterday know. I remember the 80s like yesterday. You were born in the 1900s, Guy. Yeah, born in 1967. It's a life of vintage. Okay, well, Guy, we have a couple of news articles to go over. Feel free to come to any of these, and then we'll start talking more about the work you've been doing with the committee lately, okay? Excellent. So first we have
Starting point is 00:05:49 this NFHTTP library. It's a cross platform, so you'll see HTTP library that interfaces natively to other platforms and it's on Spotify's GitHub. I don't think I've really seen a whole lot of open source work come out of Spotify,
Starting point is 00:06:05 so this is interesting. Yeah, that's an attempt at it. For me. I didn't realize Spotify had a GitHub. In fact, I have it on my laptop right now. I'm going to see if they have other things as well. A few. A couple of things.
Starting point is 00:06:20 Folsom, Skiostix, Heroic, Luigi. Oh, okay. They're quite busy people. Yeah. Yeah, this NFH TTP thing, I'm actually, I quite like the look of. I'm not sure it's going to replace the networking TS, but it looks pretty useful. And, you know, we love portability.
Starting point is 00:06:36 Right. So it looks like what they're trying to do is leverage the platform APIs of like iOS or Android or Windows as opposed to using something that's written in you know across platform language natively like open like a curl or open ssl is that right um something something curl something yes curl used on linux and android and windows obviously going to the native um well linux and android are Unix flavors anyway, aren't they? And iOS and OS X and Windows have an additional proprietary muscle behind them, so they're going through native libraries, aren't they?
Starting point is 00:07:15 Yeah. I noticed that the Linux and iOS ones are stable, whereas the Android and Windows are less stable. I do hope that. They're making great claims about it being portable and efficient. I do hope that those claims do hold out when Android and Windows are stable as well. One cost of stability can be performance, obviously. Portability, performance, stability, choose one.
Starting point is 00:07:42 Next article we have is another one from Vector of Bull, Understanding C++ Modules Part 2, Export, Import, Visible, and Reachable. Jason, did you have a chance to read through this one? I did not, unfortunately. Sorry. Okay. Guy, have you been up on the modules discussion? Are you familiar with all this? I have been reading this. It's a good article.
Starting point is 00:08:07 Actually, the paragraph. I read the earlier one. This is part two, in fact. I read part one when it was published. I do like his writing. And he's got to be applauded for describing a completely new thing quite so concisely. And modules is a completely new thing. It's a new mechanism of
Starting point is 00:08:25 abstraction it does explode the language quite quite considerably um i was delighted that we managed to introduce it into the international standard at kona although i am i do have reservations that we don't have much implementation experience i hope it will all just work and i'm sure it will it will it will just work it'll just work yes no don't hope it'll all just work. And I'm sure it will just work. It'll just work, yes. Don't hope. Yes, it'll be fine. It'll be fine. It'll be fine.
Starting point is 00:08:49 I'm sure these people know what they're doing. This is one of the great joys of writing games. If it goes wrong, no one really does get hurt. They might flame the message boards. But it's not medical equipment. It's not an airplane. It's not a nuclear reactor. It's just a game.
Starting point is 00:09:03 Fine. It's fine. It is with you that we've discussed that you you do have to do things like filter out death threats from your forums and stuff right uh oh yes obviously we have to moderate our forums at all times we are probably more likely to get the more extreme end of uh response from users than most software applications um but but it's really just an emotional response, not a plane crashing, as you said.
Starting point is 00:09:28 Not a plane crashing, no. Frankly, we can deal with that. Actually, I don't have to deal with that. We have people who deal with that for us. It's great. Nice to have people. It's great. We have an excellent marketing and communications team. I'm very pleased they're on board with us. Okay.
Starting point is 00:09:44 Next thing we have is this Blend 2 high-performance 2D vector graphics engine. It's written in C++ and released under the Zlib license. And I definitely wanted to get your take on this guy. Yes. Well, I took a look
Starting point is 00:10:00 at this. It's quite lovely. It's another 2D library because, you know know we don't have enough really i've been saying this for ages you know we don't have enough 2d libraries there's always new ways of doing this um i'm very pleased with the jit compiler and the uh uh optimizations and performance benefits that's uh that's going to yield um I haven't spoken about it with my co-author yet, but we're scheduled to talk soon. I'm going to be suggesting that this might improve
Starting point is 00:10:31 our reference implementation of the IO2D library. Interesting. So I have to make a bit of a comment on the examples on this project. Because there's a side-by-side example, if you scroll about halfway down the page, that is the C API versus the C++ API. Oh, well, yes.
Starting point is 00:10:51 It is literally exactly the same. It is, isn't it? I thought you wanted something to say about that. I started, it says that there are wrappers around these things that provide RAII and act as a smart object.
Starting point is 00:11:07 But they actually demonstrate multi-phase construction. They create a thing on the stack and then call the create member function. And then you have to check a return value. That's not RAII, right? An object has to be constructed fully, basically. That's a good point. But more to the point i think the i could be wrong but i think the the example is actually incorrect and i i could be wrong but i started digging into the source code and looking through the api because i really wanted to know what this create member function does and i could not find an implementation of it. The context object actually does have several different constructors.
Starting point is 00:11:48 Okay. Right. But all those constructors are marked to no except. So if you call an instructor with a constructor with an invalid image object and it's unable to create the context object, I don't know if it actually throws an exception, crashes, or if you're supposed to check a return value somewhere. Yeah, that's interesting.
Starting point is 00:12:04 At the moment, I'm just excited by the JIT compiler and the optimization. That's what I've read. I haven't looked into the source to the same extent that you have. I'll be doing that shortly. But I did notice the C API and C++ API examples and thought, hmm, this reminds me of my first C++ back in the 80s. Yeah. I applaud them for trying to make a C++ API,
Starting point is 00:12:31 even if it does have a few issues, and not just forcing you to use the C-style function calls. I don't know. Do you know what? I remember when I was first writing C++ and trying to get around the whole idea of suddenly having these objects and being able to have many of these objects because you know for ages and ages i was passing my first parameter as being a pointer to a struct and
Starting point is 00:12:55 just getting on with things um and it became clear that there was so much more to c++ than this and actually you can make c apis so much much clearer. You can create much clearer APIs with C++ than you can with C++. Just overloading on its own sets the entire language apart. But obviously, construction and destruction, and we all love destructors, it's the preeminent
Starting point is 00:13:18 feature of C++. And the idea of calling a construct and creating, as you say, multi-phase construction, that seems wrong, really. I think that the example might be at least partially incorrect. Well, I wonder if he's just demonstrating, or she. Actually, I don't know who is the author. I have no idea who's behind this, actually.
Starting point is 00:13:37 Okay. Well, the author, who has not announced pronouns, is possibly demonstrating that there is a C and a C++ API available and trying to show that it's broadly compatible or easy to switch from one to the other. Right. Whether or not that's a valuable thing to demonstrate, I'm not sure. And also, I just, you know, for my own self here, I'm kind of brain damaged after a couple of years of trying to teach C++ best
Starting point is 00:14:05 practices. It's impossible for me to look at code and not immediately start to just try to pick apart the code. Yes. Yeah. I'm the same. It's my job. My wife has built houses. We walk into a building or a house for the first time. I know immediately she's going to see like, oh, well, look, the trim wasn't finished right there. Or whatever, right? It's whatever you do, right? Okay. This last thing we have is
Starting point is 00:14:34 on Bartek's coding blog we've had on the show a while back. And he's releasing a free e-book, C++ Lambda Story. And, yeah, it's a short e-book all about lambdas from version C++ 11 to the changes in the latest C++ 20. I remember when lambdas were first introduced.
Starting point is 00:14:56 And was it Andre did a talk? Andre Alexandrescu did a talk about lambdas. And he said there's no one killer application for lambdas. It's just they're incredibly useful in all sorts of situations. And lambdas have really grown and grown and grown. I remember when suddenly we had generic lambdas and you could stick auto in there. And it was mind-blowing stuff. I love lambdas.
Starting point is 00:15:18 They allow for compact code. Localization of thingy. Sorry. Focus of attention, locality of reference. Yeah. And I'm fully on board with the way this was written, too, which he says, by the way, is based off of talk that was given at his meetup, local meetup. Yeah. And also, you don't have to register to download.
Starting point is 00:15:48 I mean, he wants you to register to download the e-book, but you can also read the e-book on the website. You can go either direction with that for people who care about that kind of thing. But yeah, I mean, like if you fully understand everything that a C++20 lambda can do, you have to understand object lifetime, constructors, templates, variadic templates, you know, concepts. It goes on and on. Yeah.
Starting point is 00:16:17 Great way to look at the language, in my opinion. Okay. Well, Guy, I think the last time we had you on, we were talking about the 2D graphics proposal, and it was just after the ISO committee decided they weren't going to vote it into the language. But you're still working on it. Is that right? So at Rapperswil, there was a down vote, effectively. But I decided that actually I thought it was still interesting. And what happened was I contacted the national body heads and said, well, do you still think it's interesting? Is this something I still want to carry on with? And they said, yeah, yeah, yeah, keep going, keep going.
Starting point is 00:17:02 And I thought, all right, let's keep going. And I wrote a paper for the next meeting, which was in Albuquerque. I was lucky enough to get paper number 1200, so I was able to call it high noon for the graphics proposal. Because it seemed like there was some kind of cosmic law that required I call it that. And restated the arguments, restated the case um and had the backing of many of the national bodies uh so herb decided the thing to do was to reanimate uh study group 13 which is the hmi group um and which group i'm sorry study group 13 human machine interaction hmi oh so now i'm working in so now i'm working in sgi 13 and SGI 14 and in SGI 13 we're continuing the development
Starting point is 00:17:48 we'll have another proposal ready we'll have another revision ready hopefully for Cologne having accepted feedback and of course the HMI study group isn't just about 2D graphics, we have an audio proposal in the works as well
Starting point is 00:18:04 I'm very keen that we support some standard form about 2D graphics. We have an audio proposal in the works as well. I'm very keen that we support some standard form of HMI or that we create some standard form of HMI, even if it's as a separate standard in the same way that the special math functions were published as a separate standard. And I'm keen to see this pushed forward. I'm sorry, but the special math functions were published as a separate standard?
Starting point is 00:18:27 I don't think I was aware of that. They were introduced into C++17, but they were first published in, I think it was 2012. Oh. Yeah, look it up in cppreference.com. You'll find the whole story, which you'll find there's a number of ISO identification numbers where you can find these things. Okay. I don't know why it took that route. I imagine someone like Walter Brown would be able to tell you. which you'll find there's a number of ISO identification numbers where you can find these things. Okay. I don't know why it took that route.
Starting point is 00:18:49 I imagine someone like Walter Brown would be able to tell you. How about the linear algebra work? Isn't that kind of being taken out of the original graphics proposal and trying to be standardized separately? I know what you're saying. Taken out is probably the wrong word. After Rappersville, Bob Stiegel approached me and said, do you know what? We need linear algebra.
Starting point is 00:19:08 Would you co-author with me? And I decided that actually one approach to take, I mean, one of the big problems with the graphics TS is the sheer size of the thing. It's enormous. It's actually six proposals all bursting to get out of this one giant proposal. And linear algebra
Starting point is 00:19:25 has many more application besides uh geometry and particularly in machine learning um linear algebra is used extensively uh you know frankly linear algebra is the cornerstone of uh much of mathematics and i do find it faintly peculiar that it's 2019 and we still don't have a standard matrix type and a standard well vector type we do have a standard vector type that it's 2019 and we still don't have a standard matrix type and a standard well vector type we do have a standard vector type but it's not yeah i know the the name overlaying becomes catastrophic um but i you know bub and i've been working on this we presented this at kona we presented the first edition of kona and excitement was was you know palpable lots of people saying yep yep, this is great.
Starting point is 00:20:05 This is something we should have. We were very pleased. Now, the TS process is such that you can't publish a TS based on, you can only publish a TS based against an existing standard. So we don't have linear algebra in the standard. It's not going to make C++20,
Starting point is 00:20:19 but it's possible to base, to import a paper into a TS and have it work like that. Nonetheless, whatever happens, with linear algebra in the language or in the library, then the TS will become a little less bulky, which would make it a little more palatable. But it's not just linear algebra. There's also geometry, which I'm considering adding geometry in as well. Because again, geometry has lots of...
Starting point is 00:20:44 We use geometry a lot in games, obviously, but at the moment the only maths functions in C++ are analytic ones. We need some geometric ones as well. Just speaking as a mathematician. So I'm looking forward to linear algebra moving
Starting point is 00:21:00 on and growing. We've got another revision preparing to take flight for Cologne in the summer. I would hope that we might present to the Library Evolution Working Group at Belfast in November.
Starting point is 00:21:17 Regarding vectors, I think there's a good chance we have people listening right now who know what a c plus plus vector is they don't know anything about linear algebra and they don't understand why you groaned right of course yes um so there is a mathematical concept the matrix and the vector well a vector is a tuple of scalars and it's pronounced tuple by the way it's not pronounced
Starting point is 00:21:42 tuple or tuple it's pronounced tuple and by the way. It's not pronounced tuple or tuple. It's pronounced tuple. Please everybody say tuple or my teeth will start hurting. So a vector is a tuple of scalars, and a matrix is a tuple of vectors. And is tuple also the same as the C++1? Are those things, do they compare?
Starting point is 00:22:02 Yes, they do compare. Vector is a bit of an anomaly. I'm not going to criticize Stefanov. I'm pretty sure he knows what he's talking about. But the vector class that we have
Starting point is 00:22:18 in the standard library at the moment is not really a suitable replacement for the vector concept, shall we say oh concept yeah now you're getting out of there oh watch the flames burn um the vector concepts that we uh that we're attempting to introduce through the linear algebra library um because the vector the important thing about linear algebra is performance um certainly when for example rendering a scene in a game the amount of um matrix manipulation and vector calculations
Starting point is 00:22:47 that you throw at a processor is enormous. And really, every cycle really, really, really does count. You want the best performance you can get. And if you used a vector which pointed to some data on a heap somewhere, it would be catastrophically slow. You could do much better with a local array of data, if you like. So the mechanism behind the linear algebra proposal is that actually you get to customize all these kinds of things.
Starting point is 00:23:12 You'd be able to say, well, vectors should be stored like this, and matrices should be stored like this, and these are the operations you should perform. And that customization is the value of the paper. We just have to live with the fact that we've already got the main vector used for another thing that's a bit too removed from the mathematical concept of vector to my liking. And that's not the only one as well. There are words like modulus.
Starting point is 00:23:37 You already have modulus in the library. And you have inner product in the standard library. Oh, there was a fourth one, which I've forgotten. But it's in the paper. Read the paper. P1385. And they're all wrong, basically. Well, I wouldn't say that.
Starting point is 00:23:53 But yes. Rank. That's the other one. Rank is wrong as well. But this is a thing that I'm experiencing, is that computer science is full of overloaded terms. Or rather, C++ is full of overloaded terms. Overloaded is full of overloaded terms overloaded functions at the very least well overloaded functions certainly but i'm interviewing a lot of um fresh graduates at the moment and i ask them things like uh you know tell me about the keyword const and they say well a const variable and i've grown thinking
Starting point is 00:24:20 i can be the const objects don't you you know we don't really have variables in in c++ we have objects which may or may not be const qualified um and trying to separate the trying to separate the words out and highlight what what global for example global means something in computer science but global doesn't really mean that it's a bit too mucky in c++ because we have linkage and we have file scope and you say, oh, well, what does global mean in that context? So yes, it's just another example of word clarification that we need to
Starting point is 00:24:55 tidy up and make correct. Which is basically what we do at the committee. You just mentioned that you're interviewing a bunch of interns, right? Graduates for an intern position, yes. Graduates for an intern position. Okay.
Starting point is 00:25:08 You want to talk about that? Take a slight diversion? Yeah, sure. I'd love to talk about that. At Creative Assembly, we have 12 slots open for one-year intern programs. The idea being that you go in as an intern, and then you find full-time employment while you're there. It's very rare for someone to join us and then not find their niche. And as I say, the interview process is proving pretty interesting.
Starting point is 00:25:33 I mean, let's talk about study groups. We've got study group 20, which is about education. This was convened recently. And what I'm finding is that the graduates I'm interviewing have wildly varying levels of ability when it comes to C++. And also, almost all of them have some glaring holes in their knowledge. We know, because we've been using C++ for some time, we know all the words. We know all the particular meanings of words and the terms of art if you like but teaching this is actually really hard and i was looking through um some of my favorite books
Starting point is 00:26:12 like scott myers effective c++ books and and and herb sutter's coding standards books and things like that and i was thinking all of these are you know they're not beginners texts they're intermediate texts and actually good beginners starters texts are really hard to come by. They tend to be very simple and don't really introduce the important words. I think that's a problem that needs solving. Somebody out there must be able to write a decent book. I probably will in five years' time, in my bountiful spare time, I'm sure. Okay, so I'm just curious. are most of these students coming from the same
Starting point is 00:26:47 university same university system or are they from all over the place um they're they're from europe um we're still able to get people in from europe despite everything that's going on in the uk at the moment right please say coming brexit yes the the light at the end of the tunnel is the light of an oncoming train, frankly. We do have Europeans applying, but mainly they're coming from the UK. There are some great institutions turning up. For example, I think three of the – of all the positions to four candidates, three of them came from Newcastle University, which is a bit of a shocker. I went to actually speak at Newcastle University a couple of weeks ago, and I opened the door and suddenly saw three of my candidates, which is a bit stunning.
Starting point is 00:27:33 The chap who runs the course is an amazing fellow. He has a ZX Spectrum and a ZX81 in his office, so he's all right by me. So he's delivering exactly the course that I would probably deliver. But yes, all of these people, they're mainly coming from the UK Institute, but there is no, there's no syllabus. There's no C++ syllabus. I think we as a community, we in the C++ community, we need to solve that sooner rather than later. So I don't know about you, but recruiting is just, it's impossible. There are lots and lots of people who know a bit of C++ and are not quite dangerous
Starting point is 00:28:07 on somebody else's code base. But, you know, you want to do better than that. It's been a long time since I've interviewed anyone for a job, but when I did, I decided some basic knowledge was hard to come by even then. Rob, are you...
Starting point is 00:28:21 I haven't been doing interviews for a while either. Yeah. That's unfortunate. It's a fascinating thing to do, although it's becoming slightly dispiriting. So I'll wave people through. I'll say, all right, tell me about the virtual keyword. And that's the end of the interview. Thank you.
Starting point is 00:28:39 So you bet you did find the candidates you were looking for. Nope. I found a few. There are several positions still open. I think there's still eight positions open. So should people listening to this reach out to you if they're interested? Absolutely. I thought you'd never ask.
Starting point is 00:28:54 Yes, they should. So she goes to creativeassembly.com, which is obviously our website. There's a jobs slot on there. I've been tweeting about it as well. I haven't seen that. Sorry. Well well i started tweeting a few weeks ago i started tweeting interview tips things like you know bedrooms are second only to bathrooms as poor places to have an interview um what you know well the process starts with skype interview actually the process starts with a hacker rank test and then there's a skype interview and it's a video interview it's to make sure that you haven't
Starting point is 00:29:24 got a friend lip-syncing your answers for you or something like that, which has happened. That's awesome. Yeah, it is. It's awesome. It's hard for inventiveness, but what did you think was going to happen when you were let loose on the code base? We just walked straight away at the first review. No, the first thing that happens is a Skype interview, and I would expect people to do a skype interview in a you know in a reasonably neutral private space not in front of your bed with the dog um on you know with your dog behind you panting away or your girlfriend doing her homework or whatever but but you know as i say the probably the only worst place in that would
Starting point is 00:30:00 be a bathroom fortunately i haven't had any bathroom interviews yet but i i'm sure it's just a matter of time. I think the worst I've done is a CPPcast episode in the kitchen. Because it was the only space that I could find in that particular location that we were. That was in New Zealand and a place we were staying.
Starting point is 00:30:18 Kitchens. Good sounding kitchens, no doubt. Yes, yes. So, just to clarify, Good sounding kitchens, no doubt. Yes, yes. So it's pretty algebra, yeah. Oh, just to clarify, you are looking for fresh graduates? We're looking for fresh graduates who are working on an intern program. You need the right to work in the UK, I'm afraid.
Starting point is 00:30:36 We can't offer sponsorship because it's a one-year contract, which will eventually become full-time. But unfortunately, that introductory program means you do need the right to work in the UK. So that's European citizens and British people, of course, who are still European citizens at the time being. Yeah. I want to interrupt the discussion for just a moment to bring you a word from our sponsors. Backtrace is the only cross-platform crash and exception reporting solution
Starting point is 00:30:58 that automates all the manual work needed to capture, symbolicate, dedupe, classify, prioritize, and investigate crashes in one interface. Backtrace customers reduced engineering team time spent on figuring out what crashed, why, and whether it even matters by half or more. At the time of error, Backtrace jumps into action, capturing detailed dumps of app environmental state. It then analyzes process memory and executable code to classify errors and highlight important signals such as heap corruption, malware, and much more. Whether you whether you work on linux windows mobile or gaming platforms backtrace can take pain out of crash handling check out their new visual studio extension for
Starting point is 00:31:34 c++ developers companies like facily amazon and comcast use backtrace to improve software stability it's free to try minutes to set set up, with no commitment necessary. Check them out at backtrace.io slash cppcast. So let's go back to what you're working on with the ISO committee. So in addition to linear algebra, you're working on an audio proposal? I am. So in 2017, Guy Somburg gave a talk at CppCon about audio. Guy Somburg is the talk at CppCon about audio. Guy Somburg is the games audio programmer, really. He's written a couple of books or he's edited a couple of books and essays on game audio. He's a great guy. He gave a great talk about audio. And during that talk, he made reference to my paper about why graphics should be standardized and he said all the same is true for audio and so i said hey let's do it let's make a standard audio proposal uh and he went oh okay right let's do this and and we judged a lot well you know but what else am i going to do with my time you know talk to people for goodness sake you know in 2018 we um we made a start and then i realized that
Starting point is 00:32:41 teamer doomler uh would make an excellent collaborator because he's not coming from the game side he's uh you know he's one of the big audio experts and uh he's joined us as well so the three of us have put this paper together i mean we want to standardize um a very you know the very lowest level set of functionality for recording and playback and then you know with the hope that this can be built on top of. Because many of the audio companies of the audio software houses, they're all doing the same thing at the bottom and then building additional stuff on top of that. And in the same way with the linear algebra, I just want to introduce a matrix and a vector class, and then other people can build succession papers on top of that for their particular
Starting point is 00:33:21 domains. In the same way with audio, if we can introduce just playing and recording, and then others can either write succession papers to, I don't know, playback MIDI or stream files to disk or something like that. But it takes away a lot of the low-level grunt work that's repetitive and boring and tedious and dull and is easy to get wrong.
Starting point is 00:33:39 Right. That's the motivation behind it. We presented it to Lugie, the Library Evolution Working Group incubator. Yes, yes. Laugh at that. Get it out of your systems. You know you want to. I like the names.
Starting point is 00:33:52 Library Evolution Working Group incubator, Lugie, which was chaired by Bryce Adelstein-Welbach. I believe we actually have Bryce to blame for that pronunciation. It wouldn't surprise me the slightest. He's a very jolly fellow. But yeah, we
Starting point is 00:34:07 presented to Lugie with Bryce and also with Jeffrey Yaskin and J.F. Bastion. J.F. Bastion is the Apple C++ lead. Jeffrey Yaskin is at Google. And they gave just world-class feedback to our API and to our library design.
Starting point is 00:34:23 This wasn't really a debate about whether or not it should exist. It was just simply, how should it work? How should the library work? How should the API work? Just that could have been applied anywhere. And I really came to realize, A, Apple and Google got some good people there, but also just the art of designing a library is much understated. And simple library design is worth 10,000 hours of just good implementation. Just making something easy to use is very hard.
Starting point is 00:34:53 But ultimately, the best thing, and being able to point that out and say, look, this is how this library should work. This is how this API should work. Here's where people will go wrong, is an amazingly valuable skill. So we presented to Loogie. They liked it, eventually. Timo defended the paper for about four hours. It was quite something to watch. Yeah, it was an amazing effort, an amazing piece of work.
Starting point is 00:35:17 I mean, the three of us were all in there, but certainly Timo was in the driving seat. But we're quite optimistic. Timo's produced an OSX implementation of the paper. I'm working on a Windows one at the moment, and obviously we're going to need some Unix-y ones. If anyone out there is interested
Starting point is 00:35:34 in helping us, then of course that would also be great. This is P1386. So there are two papers, 1385 and 1386. 1385 is linear algebra, 1386 is audio, or it might be the other way around. One or the other. around. You know what? One or the other.
Starting point is 00:35:47 Check them out. And if you want to help, we're not going to turn down willing volunteers. So you are hopeful that this is something that will go somewhere? Yeah, I'm hopeful. Add it to the HMI study group and then draft it up. It's a lot less controversial than graphics. Audio has pretty much unchanged for about 20 years now. And everyone's still writing the same stuff.
Starting point is 00:36:10 It strikes me as a paradigm candidate for standardization. It's dull. There's no innovation whatsoever. So, you know, the standard is where libraries go to die. And this is precisely what that is. Well, that's interesting because, I know, the standard is where libraries go to die. And this is precisely what that is. Well, that's interesting because, I mean, yeah, I'm assuming it's all PCM audio, basically, right? So you're not talking about, like, MIDI or anything else like that. No MIDI, no FM synthesis.
Starting point is 00:36:41 But, you know, it could happen. Somebody else could add that as well. The bare minimum is recording a soundwave and playing a soundwave back. What can I do on my phone? I can record my voice and I can play my voice back. I've got an iPhone. There might be FM synthesis on there. I've never found it
Starting point is 00:36:56 if there is. I don't believe there would be. It does seem unlikely. Although you can still buy the old school FM synthesizer chips in bulk if you want to. Wow. I'll bear that in mind. Add an FM API to it. Yeah. Wow, that sounds like enormous fun.
Starting point is 00:37:17 I'm sure Odin would be delighted with such fun. Yeah, I mean, it's a thing that exists. Well, this is really an aside at the moment, but I watch a lot of retro computing YouTube channel videos and, uh, you can still buy like, uh, retro, um, parallel port,
Starting point is 00:37:33 FM synthesizer, like, or MIDI, whatever add on for your, you know, old school computer or whatever, if you want, like,
Starting point is 00:37:40 you know, to be able to do that kind of thing because the finding the original sound cards can be difficult now. And there's, there's a lot of aftermarket things available basically i was gonna say i was really into chiptunes and all of the you know all of the music from the games of the 80s it's it's seared into my memory i'm not going to forget that i spent most of the early 80s hanging around arcades well if you really you really want to, you can buy an 8-bit ISA card for your 486 that you can
Starting point is 00:38:09 put a Commodore 64 SID chip in it. Wow. Take my money! Yes, that kind of thing is being produced new today, that adapter card. This sounds like summer holiday fun to me.
Starting point is 00:38:25 Maybe I can do a theme tune for CPP Cast. We would accept that, I believe, yes. Great, yeah. What other proposals do you still work on? Ring buffer? Yeah, ring buffer. Now, this is my first proposal. The paper number is 0059.
Starting point is 00:38:44 That's how old it is. And I've been trying to... Is that from the 1900s? Yeah, no. I think it's from 2015. That's when I first started becoming involved. A ring buffer is tricky because everybody has their own idea of what a ring buffer is
Starting point is 00:39:02 and so it becomes, oh, no, no, it should have this. No, no, it shouldn't have that at all and people argue about it and you know i've set it aside but now i've actually got a really strong motivation for introducing the ring buffer because obviously this is fundamental to audio playback is you fill up a buffer and then you then whilst it's being played from you fill up another buffer so you'd have a ring buffer with two items in um one of Or four items perhaps if you've got stereo channels or something like that. Or maybe ten items with
Starting point is 00:39:29 five or twelve items for five, one, sand. Anyway, ring buffers. Seven, two. Pardon? Seven, two. That's a thing. Is it? Yes. What's the two? Oh, is it stereo subwoofers? Stereo subwoofers stereo subwoofers yes
Starting point is 00:39:45 directional subwoofers what's the point of that i didn't think bass was particularly directional i don't know i just know that point two exists i'll look into that in my non-c++ time um yeah so ring buffer a ring buffer is something that every audio program will have written and got wrong about a dozen times before you know going to stack overflow and pleading for help sounds exciting well you know it's the sort of thing that everyone's done and got wrong and finished again it's the sort of it's where like the standards of our libraries go to die there only needs to be a ring buffer just write it stick it in the standard and nobody else needs to waste hours and hours of their valuable time creating something that's already well established okay so uh based on what you said you know like these things are solved problems
Starting point is 00:40:31 there's no reason to waste your time on whatever it's just something i've been thinking about a little bit lately i've never personally written to like the audio driver like i've never done that but i have done you, lots of old school things that I find that the experience, even though it's painful and I waste a lot of time is not that, that, that experience is valuable. It means something later, right? I might be debugging some other problem and that experience now comes to the forefront of my mind. So where is the line between like, well, I mean, I would totally agree like shipping software should use the standard API that everyone is. But where do you encourage or not encourage, and particularly in the context of young students learning programming, to say, yeah, you should go back and write something straight to the hardware and understand how that works.
Starting point is 00:41:24 And now that you've done it, move on. That is an excellent question. I'm going to have to think of an answer. I guess it depends who's paying for your time. Frankly, it depends who's paying for your time. If I was running a software company and then somebody said, yeah, I'm just going to write a ring buffer
Starting point is 00:41:39 and there was one in the standard waiting for me, I'd have strong words to say to them. But if i was their professor their lecturer on their c++ course and so he said i'm going to write a ring buffer i go great excellent see how it works and i think that kind of i think that could be that would apply everywhere you know c++ isn't just all about fun right you know sometimes c++ is all about you know solving problems for money and you know if a problem's being solved and it's a time time consuming solution then you probably owe it to the
Starting point is 00:42:12 person who's paying you to use the to use the solution that's already there and spend your time on the things that haven't been solved yet as a manager who is also concerned about the education of your employees, would you ever, this is a hypothetical, right? Cause I've never had employees. Would you ever say, I don't,
Starting point is 00:42:30 I'm not saying it's hypothetical that I'd be concerned about my employees. I'm saying you are concerned about your employees. I am. You are. Would you ever say, okay, you can spend a day writing that ring buffer so that you understand what goes into it and then stop and go to the standard one
Starting point is 00:42:48 that we already have available. Well, I guess another take on that is, is the one in the standard sufficient? Okay. Is there actually a better solution? For example, we tend not to use the standard containers in game dev because they have additional overhead,
Starting point is 00:43:06 which makes them unsuitable. For example, exception handling. Exception handling is not something we do in games. What would we do with an exception? We'd simply stop the program and tell people to start the program again. So all the exception handling is, and the furniture that carries with it,
Starting point is 00:43:22 isn't really very useful to us. If you're working on a console, you have a very limited amount of space and you think, do you know what? Exception handling is not something I've really got time for here. So we don't use containers. So certainly, it's a rite of passage
Starting point is 00:43:35 when you start optimizing a game. If you're writing your first game engine and then you start looking at where all the bottlenecks are and you think, hmm, that vector, that's not, I can do better than that. I need to do better than that. And that's what motivates people to re-implement parts of the standard.
Starting point is 00:43:57 Ideally, what motivates them is measuring, measuring again, measuring a third time, and then optimizing at the 80%. Sorry, optimizing the 20% where the 80% of the code is executed. Right. Okay. at the 80% sorry optimizing the 20% where the 80% of the code is executed right is there anything we haven't talked about yet with regards to your work in the standards committee no I've been very busy I remain busy
Starting point is 00:44:15 there are linear algebra telecons in fact there's one in about 40 minutes so if people want to join in on linear algebra look at the SG14 mailing list we have a monthly linear algebra telecon teleconference on the first wednesday of every month uh immediately prior to the sg14 telecom on the second wednesday of every month um i don't think i could take on anything more which probably means i'll be taking on something else i'm pretty sure you're going to be playing with sid chips on your pc this summer. Yeah, but that'll be in my sleep.
Starting point is 00:44:48 Anything interesting you want to plug with Creative Assembly? I know you're working on another Total War game, right? Yeah, we are. Total War Three Kingdoms. Please buy it. I do have both of the Warhammer games now. Do you? Oh, right. We're working on a third one as well. The third one was
Starting point is 00:45:03 announced when the second one was announced, so I can't talk about that. I don't know when the shit plate is, but we have a third one coming well the third one was announced when the second one was announced so I can talk about that, I don't know when the shit plate is but we have a third one coming out, it's going to be brilliant yeah, Total War continues to go from strength to strength I'm delighted to work at Creative Assembly and I think anybody who joins our company is making a good move so I'm going to plug the jobs
Starting point is 00:45:19 at creativeassembly.com email address and invite people to join our happy throng okay I think that's all we've got for today, right Jason? yeah, I think so dot com email address and invite people to join our happy throng. Okay. I think that's all we got for today, right, Jason? Yeah, I think so. Okay, thanks so much for coming on the show again,
Starting point is 00:45:33 Guy. It's been excellent fun, thanks. Thanks. Thanks so much for listening in as we chat about C++. We'd love to hear what you think of the podcast. Please let us know if we're discussing the stuff you're interested in, or if you have a suggestion for a topic, we'd love to hear about that too you can email all your thoughts to feedback at cppcast.com
Starting point is 00:45:50 we'd also appreciate if you can like cppcast on facebook and follow cppcast on twitter you can also follow me at robwerving and jason at lefticus on twitter we'd also like to thank all our patrons who help support the show through patreon if you'd like to support us on patreon you can do so at patreon.com cppcast and of course you
Starting point is 00:46:10 can find all that info and the show notes on the podcast website at cppcast.com

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