CppCast - C++ Insights

Episode Date: June 21, 2018

Rob and Jason are joined by Andreas Fertig to discuss C++ Insights, the Rapperswil ISO meeting and more. Andreas Fertig holds an M.S. in Computer Science from Karlsruhe University of Applied S...ciences. Since 2010 he has been a software developer and architect for Philips Medical Systems focusing on embedded systems. He has a profound practical and theoretical knowledge of C++ at various operating systems. He works freelance as a lecturer and trainer. Besides this he develops macOS applications and is the creator of cppinsights.io. News Post Rapperswil C++ Draft Cpp Taskflow std::embed updated proposal JetBrains Rapperswil Trip Report What's all the C Plus Fuss? Bjarne Stroustrup warns of dangerous future plans for his C++ Andreas Fertig @andreas__fertig Andreas Fertig's website Links C++ Insights C++ Insights Store Sponsors PVS-Studio February 31 Patreon CppCast Patreon Hosts @robwirving @lefticus

Transcript
Discussion (0)
Starting point is 00:00:00 Episode 155 of CppCast with guest Andreas Fertige, recorded June 20th, 2018. demo version today at viva64.com. In this episode, we discuss more news and trip reports from the Rapperswil ISO meeting. Then we talk to Andreas Fertige. Andreas talks to us about C++ developers by C++ developers. I'm your host, Rob Burfing, joined by my co-host, Jason Turner. Jason, how are you doing today? I'm all right, Rob. Soing, joined by my co-host, Jason Turner. Jason, how are you doing today? I'm all right, Rob. So I guess you decided to change the intro there, huh? Yeah. Well, we talked about it for a couple of weeks, so I decided to actually pull the
Starting point is 00:01:33 trigger on it. Why not? Okay. Well, you know, it's kind of fun to keep it as the only one, even if it was a bit of a lie. Yeah. Well, we'll see how everyone reacts to that one. You have anything you wanted to share, Jason? Well, I'm traveling again at the moment, so I apologize if the audio sounds a little weird. I have my lower-quality headphones, and I'm in an echoey room, I feel like.
Starting point is 00:01:57 But you'll probably take care of that in post-processing. Yeah, hopefully. And maybe some of our followers might have seen some mentions on Twitter that I had been scheduled to do a keynote at ASML in Eindhoven, Netherlands that was yesterday and that was a fun time
Starting point is 00:02:14 late night so I'm in the Netherlands at the moment awesome okay, well at the top of our episode I'd like to read a piece of feedback this week we got an email from Nicholas and he wrote in saying Awesome. Okay. Well, at the top of our episode, I'd like to read a piece of feedback. This week, we got an email from Nicholas, and he wrote in saying, in the last episode, Jason said that he would like to know what else got merged into C++20 that Bryce didn't mention in the Reddit thread.
Starting point is 00:02:37 Well, for that, you can look that up in post-meeting milestones on GitHub under the C++ Draft Project. And he included a link. And he wrote also wrote a spoiler constexpr swap is in it. Anyway, thanks for the great episode. Keep it up. So that's something you're looking for Jason constexpr swap. I did look at the C++ draft things that had gotten merged in from this link and am happy to see that the constexpr swap related things got in, which means that we've got constexpr sorting in C++20 now. Awesome. Okay, well, we'd love to hear your thoughts about the show as well.
Starting point is 00:03:15 You can always reach out to us on Facebook, Twitter, or email us at feedback at cppcast.com. And don't forget to leave us a review on iTunes. Joining us today is Andreas Fertige. Andreas holds an MS in computer science from Calzaro University of Applied Sciences. Since 2010, he has been a software developer and architect for Philips Medical Systems, focusing on embedded systems. He has a profound practical and theoretical knowledge of C++
Starting point is 00:03:41 and various operating systems, and he works freelance as a lecturer and trainer. Besides this, he develops macOS applications and is the creator of cppinsights.io. Andreas, welcome to the show. Welcome. So when you say you develop macOS applications, you just mean on the side for the fun of it,
Starting point is 00:04:01 like you have apps in the App Store kind of thing? Yeah, it's a bit for the fun, that's true, and you have apps in the app store kind of thing yeah it's a bit for the fun that's true and i have them in the app store um so you can buy them so i make a little bit of money with them but well not enough to retire yet well why don't you go ahead and tell us what those apps are um they are they're started with an idea because i do my presentation my talks all that stuff with tech and the result then is a pdf file which is not so good for presenting if you like to have some indication how long the presentation is running and if you like to have notes and such things so i created this one app which is called projector which basically takes in a pdf file and an additional notes file and it presents and
Starting point is 00:05:02 gives you also one of these nice presenter screens right so if you present using like powerpoint that's the type of thing it'll do for you but if you want to use a pdf it kind of gives you that presentation view similar to what powerpoint does yeah basically a reduced view but it does the job nicely it It shows you the current slide, the next slide, and it denotes to the current one as well as time elapsed and current time, things like that. That's awesome. Yeah.
Starting point is 00:05:33 Okay, so Andreas, we have a couple news articles to discuss. Feel free to comment on any of these and then we'll start talking to you more about CPP Insights and some other stuff you have going on, okay? Yeah, fine. Okay, so to you more about CPP Insights and some other stuff you have going on, okay? Yeah, fine. Okay, so this first one is CPP Taskflow.
Starting point is 00:05:54 And this is a C++ header-only library to help quickly build parallel programs with complex task dependencies. And this looks like a pretty powerful library. Building such complicated tasking is not really something I have a whole lot of experience with, but some of the examples look pretty cool. Do you have a chance to look at this, Jason? I did look at it, and I have worked on projects where I think I might have used something like this. I don't currently work on a project where I could use this.
Starting point is 00:06:23 But I agree, it looks pretty, it looks impressive anyhow. Yeah. Andreas, did you have a chance to look at this one? Yes, I did. And I can also say it looks amazing, very simple and basic. But, yeah, I don't do much of that threading things either so i cannot really tell whether it's good or not it just looks very handsome okay uh next one is uh an update to the stood in bed proposal and we talked about this one when we had uh jean monique on the show but uh i thought
Starting point is 00:07:02 it was just worth mentioning because he did put out an update um and i believe he was just at the jacksonville c++ meeting so i'm not sure uh as well yeah rep as well not jacksonville um so i'm not sure what kind of changes he made after that meeting but uh he did put out an updated proposal yeah i, I agree. I was looking to see, oh, let's see, it does say what the revisions were. Future directions, changed a couple of names of things, add code demonstrating old way
Starting point is 00:07:32 and motivating examples and incorporates feedback. Yeah. Okay. And then the next one, we have a trip report from JetBrains, and this is for the Rappers Will C++ meeting. And this one is written by
Starting point is 00:07:48 Phil Nash and Timur Dumler. And they went over a lot of the news that we talked about last week with the Rappers Will meeting. Modules, having the converged modules, proposal, concepts, coroutines.
Starting point is 00:08:04 They did talk a little bit about the SG15 tools group, which they went to as part of JetBrains. And that was interesting to read. They had members from the Build2 package manager, VC package, and Conan. That was kind of the focus of this meeting. It seemed to be on package management. And I,
Starting point is 00:08:28 it sounds like they discussed whether or not the standards should kind of create like a standard package management, like API. But it sounds like they kind of voted against doing that, but are kind of encouraging the, these different package managers to work together kind of outside the scope of the committee. Okay. Yeah.
Starting point is 00:08:52 Anything else you wanted to highlight from that? I feel like I wasn't paying close enough attention or something, that I missed something, but I was surprised here to read for coroutines that they said that the committee doesn't seem to be clear as to whether or not our current, the current coroutines proposal is the appropriate way forward and that Google presented a counter proposal. Yeah. And we briefly mentioned that and it had the different syntax for like awaiting a coroutine, right? I thought that that was an addition to what gore
Starting point is 00:09:27 had been proposing not a replacement but um i don't know andreas do you know um i wasn't in the room when this was discussed but i wouldn't necessarily say it's a counter proposal i think proposal, I think they tried to solve so far unsolved issues if you like to call that. And yeah, it was their view how it could be solved. They also acknowledged that the time is very limited if we like to
Starting point is 00:09:58 get this in C++20. So they mentioned this in a few parts in the paper that some of these things may come later, so it may be a two- or three-step approach, but they seem to have real concerns with parts of the current coroutines. So you attended the meeting then? I did, but not this part. I was in Ruppersville, but I do not really recall where I was when coroutines were on the table. Well, that's fine, but is there anything else
Starting point is 00:10:32 that you would like to mention about the meeting? Aside from the fact that it was really huge and awesome, I think there are a couple of nice things coming up on the ConstExpert path. So we already heard there will be a ConstExpert swap. There will also
Starting point is 00:10:56 be, I'm not really sure. When I now say there will be, it's not meant that it will be in C++ 20. I'm not always sure on that, say there will be, it's not meant that it will be in C++20. I'm not always sure on that. But there will be relaxed conditions for constexpr so that you can say new in the constexpr context as long as you say delete at the end. From one point of view it never happened as long as you just use the memory during the constexpr doing its thing it never hits the binary so it doesn't matter
Starting point is 00:11:32 if you say new and delete. I think that's quite impressive and there will be it was in the paper it was called constexpr bang so constexpr function which is called constexpr bang. So constexpr function, which is truly constexpr, such a way that the compiler will give you an error if it does not meet all the constexpr requirements. I think that's brilliant. This can help to solve a couple of problems
Starting point is 00:12:05 and there are other things on the constexpr path well being able to do new in a constexpr context changes a lot of things yes I think they needed to get constexpr containers and stuff like this so they can allocate at compile time that's interesting because it's still only clang that supports heap elision optimization which is allowed by the standard and i feel like these things seem similar because you're kind of heap alighting at compile time
Starting point is 00:12:40 and it makes me wonder if having to implement this will mean that some of the other compilers will ultimately get some heap elision for non-constexper code kind of support it. Or maybe these will go down two completely different paths and it doesn't make any sense at all that I just mentioned them together.
Starting point is 00:13:01 Well, we will see. Okay, and then the last article we have to discuss uh this from the register and uh we talked either one or two weeks ago about bjarne's paper uh remember the vasa and this was an interview with bjarne uh relating to that remember the vasa paper he wrote and kind of the warning to the ISO committee to not kind of heap on all these little proposals and kind of focus on the bigger story. And it was an interesting article, interesting interview to kind of expand out what Bjarne's thoughts are
Starting point is 00:13:44 on the future of C++ and C++20. And there are a couple of interesting things that he mentioned. One thing which he brought up which was news to me is he mentioned the SG15 tools group, but he also mentioned that there would be an education group forming, which I guess would have a focus on how we can improve the standards so that C++ can become a more teachable language. I guess that's what I'm inferring at least. I had heard something about that, but I haven't read too much about it.
Starting point is 00:14:16 If I recall it correctly, it was Wednesday evening. It was one of the evening sessions. It was the time when evening sessions. It was the time when the direction group was announced or this paper was shown. I'm also not completely clear
Starting point is 00:14:35 in which direction this teaching group will go, but the common consensus was that it seems to be not nice for the C++ community that other languages come first in teaching on the university. So that probably is one thing they like to get improved. And so the question is, can we tell how to teach C++?
Starting point is 00:15:04 Or even does it help to improve the language if we know how to teach C++ or even does it help to improve the language if we know how to teach it so we can simplify it or whatever? I think it's not really clear, but it's clear that teaching can help the understanding. Right. And as someone who attended the Rapperswil meeting, did this Remember the Vasa paper come up a lot as a point of discussion about whether or not this proposal is worth being considered or something like that? Piana mentioned, I think, the whole story about the Vasa.
Starting point is 00:15:46 It was quite interesting to hear that one. And yeah, the concern is that with 160 people attending Rapperswil, there are a lot of people involved and how to focus on, well, I don't know how to put this, the interesting things or the things which really make C++ a better language and not by the same time meaning it gets closer to C Sharp or to some other language, but stay
Starting point is 00:16:16 on its own and be excellent at that. I think the story goes that Avasa could have been saved because they made a trial run, discovered that it will not survive, but didn't tell the king and let it sink, more or less.
Starting point is 00:16:36 And yeah, the idea is don't, or do tell if you have feelings that C++ may sink or so. Be sure to tell King. Yeah, tell the King. But there is no King, so that's the problem here. Okay. Well, why don't we start by talking about CPP Insights, Andreas. Can you just give us an overview on what that project is?
Starting point is 00:17:05 Yes, sure. The project or the idea behind the project is to show the parts of the things the compiler does for us behind the scenes. I like to mention it's not the way I like people to write code. It's just to see what a compiler does and not to say, oh, that's awesome. It's a whole lot of code. I should write that. No. The idea is to use it, for example, for teaching because it's sometimes hard.
Starting point is 00:17:43 What's the difference between plus plus I and I plus plus? You cannot tell without looking closer. Is I a class or is I a trivial type? If it's a trivial type, it doesn't really matter for the sake of performance. But if it's a class class then there is an operator involved maybe. And this is what Insights shows. It shows you where operators are involved, invoked. It shows transformations like, hey what's behind range space for loops? They just boil down to regular for loops,
Starting point is 00:18:28 things like that, so that you can also get a feeling how heavy or how lightweight is one of these features, which is interesting for the embedded sector I'm in, so I like to know how this stuff works. Generating lambdas, for example,
Starting point is 00:18:44 they seem cheap. In most cases, they are, but it helps to know what's really happening there. So was your work working on embedded devices that first inspired you to create this project?
Starting point is 00:19:00 Partially. The inspiration came or the idea came roughly a year ago when I was preparing a talk for NDC Oslo at the time called Fast and Small. In this talk, I showed examples like range-based for loops, lambdas, and how they are handled internally. And I also used this in one of my lectures and in the training. And then I thought, okay, I did this thing now, I converted it four or five times and all the time in different ways.
Starting point is 00:19:38 And if I look at tools like the Compiler Explorer, it's really easy, right? I mean, I type the code in and I get the result on the right most of the time and I can choose the different optimization levels and then I see how it acts or performs. And so I started writing at a time a really, really small Clang AST-based tool
Starting point is 00:20:04 which transforms more or less just a range-based for loop and a lambda. really small Clang AST based tool which transformed more or less just a range based for loop and a lambda. That was enough at the time. Then I added more and more features or statements the tool understood
Starting point is 00:20:19 well till now and it's not complete. It doesn't understand all the statements. You can write in C++, but a good amount of them, at least. So I guess you kind of alluded to how it's implemented, then you're using the Clang AST in some way? I use the Clang AST.
Starting point is 00:20:43 It's a libclang or libtooling-based tool. So in that time, I got very keen looking at the Clang AST. But I used the AST for the initial presentation. It's just, it's not so much readable, or it was not at the time for me. I now grew more to it. Having all these pointers and the tree view,
Starting point is 00:21:13 and it's not C++. It's an abstract view. And I did like to have it in a C++ way, because I'm writing C++. Looking in the Compile Explorer, how the resulting binary is, is one really helpful thing. But sometimes I just like to know,
Starting point is 00:21:37 oh gosh, why is this behaving so strange? And C++ insights may help to uncover this. I had the chance yesterday, I started watching your talk, Jason, about initializer list is broken. And I punched in a couple of your early examples into C++ Insights and I discovered it shows some of the cases where you mentioned,
Starting point is 00:22:04 okay, here in this, I think it was a vector initialized with curly braces, 3,3. And in this case, you get an initializer list, which is not obvious. Right. C++ Insights shows that. So it could be helpful to understand what's happening in some cases. Yeah, I will say I have actually used your tool in a training that I did last Thursday, and it'll probably come up again this Friday. Oh, excellent. And yeah, so maybe if we can clarify for the listeners, you type in C++,
Starting point is 00:22:44 and you're effectively showing us, if I understand correctly, how the compiler sees that code. At least I try to. Be aware that it's my understanding of what the compiler does, my understanding of how the Clang AST is, and I may be wrong, and I may have written some wrong code in some places.
Starting point is 00:23:08 But basically, yes, if I do a good job and if everything is right, then it's more or less what the compiler did the full picture of the compiler. Okay. So it is just clang then like
Starting point is 00:23:23 Visual Studio might be interpreting a for loop in a completely different way. Partially true. It is just Clang, yes, that's good to mention. So be aware of that. It also depends if I build it on Linux, which uses GLibC by default, or on my Mac, which uses LibC++. Sorry, GLib, no, LibStuteC++ is on Linux, and LibC++ is on macOS. And you can see the different implementations. For example, for std string,
Starting point is 00:24:08 it does essentially the same, but the template is a little bit different. Interesting. Yeah, yeah. That are the things. But for the range-based for loop example, that's written in the standard how it should be. And I don't think they really bother changing that.
Starting point is 00:24:29 I'm not really sure about the lambdas. They are also in the standard, but there are for sure a few, well, open scenarios where the implementers have their freedom. Yeah, it has been my experience so far that all the compiler vendors tend to have taken the same approach to things in Lambdas that I might have thought were open to interpretation.
Starting point is 00:24:56 So there must be one fairly obvious way, I guess, to implement them in many places. Yeah, it looks to me the same yeah so are there any um limitations to the tool that uh you're aware of or that maybe you uh plan on fixing oh sure um First of all, it's not complete yet. It has, depending now on how your knowledge on Clang and AST matches are, it uses Clang AST matches to match constructs I know that I can transform. And in the context. So it may be... I do not currently transform the whole file,
Starting point is 00:25:56 just pieces out of it. I rewrite if statements, for loops, range space for loops, and a lot of things. But if they appear in different contexts, the tool currently may not rewrite them. And that comes from the initial fact that I wanted to just transform range-based for loops in Lambdas. And I have the plan to convert it in a way such that it rewrites the whole file so that you see really everything.
Starting point is 00:26:32 That's the one thing. I also suppress some things I can show right now. All the implicit casts but I decided that so I do not suppress all of them but a couple of them because they tend to really increase the output
Starting point is 00:26:55 by a lot. I think that's okay we should make the users of C++ feel the pain of the C++ Yeah, maybe. That could also be in the future an option to turn it on or off the verbosity level or something like that.
Starting point is 00:27:16 So that's the one thing. It also has no C++20 support, at least not that I'm aware of currently. So this is definitely something coming up soon. I think there are bugs and I get bug reports or issues and I try to fix them. I know that the most interesting thing
Starting point is 00:27:44 seems to be lambdas. So the most issues or reports I got from all over the web are related to lambdas. And they are pretty hard. I can tell you that. At least if you try to rewrite them. I don't know a thing about implementing them in the compiler and do a good job there. But it's really hard to transform them.
Starting point is 00:28:08 And there on that part I improved, but I'm still not sure I covered all cases. I got really interesting cases. The thing is if I transform something then I need to
Starting point is 00:28:23 put this result somewhere better at the right position. So for Lambda, it's close to where you declared and defined it. And you can introduce Lambdas, for example, in a function call. That's what we do with a lot of the std algorithm functions. So we pass a lambda for the sort, for comparison and stuff like this.
Starting point is 00:28:57 And now think about this. Where should I place the class for the lambda? I cannot place it in the function call because there it is not allowed. But Clang, on the other hand, in its AST can do that because it does not have to consider the same rules in the AST as a developer have when I'm writing the code. So that was one really, well, interesting insight I got there.
Starting point is 00:29:31 So Clang can, or other compilers as well, can do other things there because they just passed that lambda and blew it up to a class. Why not directly put it into that function call? That doesn't matter anymore at this point. But for me, it does if I transform it. So I must find the best point before to insert the lambda class.
Starting point is 00:30:01 I thought I solved that and then somebody came up and showed me a lambda I never even thought about this you can obviously in the capture list of the lambda declare another lambda
Starting point is 00:30:17 which you're capturing by copy I was just made aware of that because when I questioned a student I asked myself, actually. Okay. And you can also pass then in a lambda in the call operator when you call the lambda. Okay. So there are some cases I never thought about before, but now I know that they're there.
Starting point is 00:30:43 And I did my best to also cover them. And as far as I know, they work correctly by now. But yeah, so there are these things. Are there other limitations? Well, it does only
Starting point is 00:30:59 transform C++, but I think that's okay. I don't know where this++, but I think that's okay. I don't know where this was, but somewhere I saw an interesting comment when I first posted about the tool. It hit Twitter and Reddit and all that,
Starting point is 00:31:16 and I don't know where I read this, but somebody said, I all the time thought that CPP stands for the C preprocessor. So, CPP stands for the C preprocessor. So CPP in an URL seems not to be the best. Seems kind of confusing. But yeah, now it's out.
Starting point is 00:31:37 We don't really have the choice in a URL, though, unfortunately. Yeah, maybe we shall change the language name, but that's also, well, not so easy. Well, aside from the lambdas, that's related to bug reports. Is there anything surprising that you learned when you were developing? Something that surprised you about
Starting point is 00:31:57 C++, perhaps? Yeah, probably more than I can remember. During the Rapperswool and my Oslo trip, I had a lot of time in planes and trains. So I started transforming class templates. I didn't do that before because it was hard, but I had the time then and I did it. And while doing this, it was the first time that the tool transforms a whole class because if you have a template class and invoke it,
Starting point is 00:32:36 I have to generate, well, the entire class, but with the correct types and so on. And while doing that, I stumbled over the fact that we can now have inline variable initializations in classes. So I don't need to initialize a certain variable
Starting point is 00:32:55 in its class constructor. I can also directly initialize it. I think everybody already knows that, right? I am aware of it. I thought so. So, and what I came across is, how does this initialization work? Okay.
Starting point is 00:33:14 And surprisingly, the answer is, this may be related to Clang, I don't know, but the answer is easy. This initialization gets just moved into the constructor as one of the initializers of the constructor, which surprised me. Oh, okay. It's very easy. I think it doesn't require special rules there. Just take this value, take this variable name,
Starting point is 00:33:40 and then put it in there, and you're fine. So that's one thing I can remember. Structured bindings are also a beautiful thing to learn a lot about. Clang seems to use them in a very easy way. So a couple of examples I also have shown on slides and I see in the web seem to be not true for Clang. So if you have just a struct with, I don't know, two members,
Starting point is 00:34:15 it's such a struct called point and it's an int and x and epsilon in it. And if you do this decomposing with structured bindings, the most examples, including mine, show that there is a get involved, something like std get, which gets this value out of this point struct. And Clang seems to be smart enough to don't use any get there.
Starting point is 00:34:43 It just says okay if you're struck point P then I call P dot X and P dot epsilon and that's it so no further magic there so sometimes the web seems to be
Starting point is 00:34:59 not completely correct at least for clang right I want to interrupt the discussion for just a moment to bring you a word from our sponsors not completely correct, at least for Clang. Right. I want to interrupt the discussion for just a moment to bring you a word from our sponsors. PVS Studio is a static code analyzer that can find bugs in the source code of C, C++, and C-sharp programs. The analyzer is able to classify errors
Starting point is 00:35:18 according to the common weakness enumeration, so it can help remove many defects in code before they become vulnerabilities. The analyzer uses many special techniques to identify even the most complex and non-obvious bugs. Thank you. First, the link is under the description of this podcast episode. The analyzer works under Windows, Linux, and macOS environments. PVS Studio supports analysis of projects that are intended to be built by such common compilers as Visual C++, GCC, Clang, ARM Compiler, and so on. The analyzer supports different usage scenarios. For example, you can integrate it with Visual Studio and with SonarCube. The Blame Notifier tool can notify developers about errors that pvs studio detects during night run by mail you can get acquainted with pvs studio features in detail on viva64.com uh you mentioned that you're working
Starting point is 00:36:17 on this on your way to wrappers will um what kind of role did you have at the Rapperswil committee meeting? I was there privately just observing. Nothing special. No papers that you submitted on your own? No. I did thought about this Constexpr bank and I had a proposal of my own, but it was not nearly as good as David as david's and i think richard's paper was so it didn't make sense to come up with this so i was just there to to listen um which was quite amazing is this the first meeting you've attended yes yes it was the first meeting. It was three and a half hours away from where I live.
Starting point is 00:37:06 So that was a good chance to go there once at least. And there are more meetings coming up in Europe. So I may attend more of them. Do you have any advice for anyone considering attending as an observer like you did? Sleep a lot before. Because it tends to be early and late. I was really, really tired after that meeting or that whole week. And oh, by the way, it's a six-day week,
Starting point is 00:37:40 so Saturday is also concerned for working or used for working and the people there are really eager I think to that's my observation to get the things done to get new better C++ so
Starting point is 00:37:57 expect them to be really eager to work that's what I've seen so far what meetings were able to attend? Like which working group did you go to? I spent most of my time in EWG, but I was also in LEWG. So I was, for example, there when Studix Embedded was presented. that was in LEWG. I was there when Herb Sutter presented a portion
Starting point is 00:38:29 out of his static exceptions proposal. And EWG was, I think, most of the time, modules, concepts, and one day or half of a day was then the constexpr things. So that's what I have attended, roughly. Did you get a feeling for how embed was, what the committee thought of the standard embed proposal?
Starting point is 00:38:59 If I recall it correctly, they support it. With Span, it seems to be a good solution. I think it's also received as a long-standing pain. The author of the paper also mentioned that the authors tried to solve this problem in the past. So he's aware of that. The community is aware of that. Overall, I think it's a good thing and it has the support from the standard committee.
Starting point is 00:39:40 I wonder if we'll see it in C++20 or not, ultimately. I would like to see it, personally. It's worth mentioning that the C++20 feature freeze is the next meeting, right? Yes. I cannot tell you how far in the progress it is. I think it's in the beginning. But, yeah, I cannot tell. But it's, yeah, it has to hurry if it likes to be in C++ 20,
Starting point is 00:40:11 at least according to the current schedule. I should hurry up and write those 10 proposals I've been meaning to make as well. Yeah, you should. Yeah, right. You also mentioned that you were there when Herb discussed his static exception proposal how was that taken and you said it was just a piece
Starting point is 00:40:30 of it that he was presenting yes it was only the piece about if you agree on what's an error and what's an exception so one example he showed was
Starting point is 00:40:48 the case of out of memory. On the Linux if you call malloc you always get something back. It may just not be valid memory And you may realize it way later in the program when you actually try to use that memory. Really? Yeah, happens to be, yeah. And so the question is, can you do anything against the things? And the fun part is,
Starting point is 00:41:20 if Linux really runs out of memory, it starts trying to kill a random process. So it may not even be the process which caused the out-of-memory situation. So it can then kill you or it can just kill a random other process. But the thing is, there are certain things, if we change behavior, then nobody will notice
Starting point is 00:41:44 because the people running in an out-of-memory situation today will either terminate now or later. They cannot know. They cannot test it. And if you say, okay, that's something that's not an error because it cannot be recovered, well, then that's fine too so roughly that route
Starting point is 00:42:09 probably Herb can explain it a lot better but it was received really really well if I recall the polls correctly then it was only strongly in favor and in favor and nobody voted neutral or anything about against wow that's really
Starting point is 00:42:29 good and he's definitely not trying to get that paper into c++ 20 though he's he's aiming for 23 i guess i said it was just a portion out of the paper to get a better feeling if it's all right to to continue with that he had a couple of examples, which are in the paper, which is available, where he's quoting how it would, what impact it would have on certain implementations. I think Microsoft Office, things like that, were in there, which could get rid of a couple of, I think they have abstraction layers in there to ask if this operation would succeed or not.
Starting point is 00:43:15 So that they do not run into an exception, things like that. And they could remove all that. There are other corner cases. So it's just seeing the first start of the proposal. And I'm very sure that it's not C++20. And I'm not really certain if it will make it to C++23. It's a long time, so probably, but I don't know. It seems to be also a huge change.
Starting point is 00:43:46 Wow. Okay. You also recently attended NDC Oslo, right? Yes, I did. It was last week. How was that conference? The conference is great. I had the opportunity to be there the second time.
Starting point is 00:44:06 It's a big conference. They have nine to ten tracks in parallel. It's a three-day conference. There are a lot of people there. I don't know, 1,000, 2,000, something like that over the days. It's surprisingly quiet for that amount the days. It's surprisingly quiet for that amount of people. It's just really nice. They
Starting point is 00:44:33 serve food all day, which is also brilliant. Not so much for the weight, but for other things, you get snacks there, you get drinks, which makes it really easy and
Starting point is 00:44:48 friendly to hang out with people. They have, I think, not the strongest C++ focus. They have all sorts of things, so
Starting point is 00:45:05 C Sharp, JavaScript, also more personal things they sometimes share. So it's a huge diversity you will see there from
Starting point is 00:45:23 talks. Sounds interesting. Yeah. And much larger than I would have assumed. Yeah. I think it's definitely worth going there once, at least to see it yourself. I think it's one of the greatest conferences I've been so far.
Starting point is 00:45:46 Oh, wow. think it's one of the greatest conferences I've been so far. But yeah, don't expect too much from the C++ side. It's more the people and the conference itself than the C++ part. Now, did you say earlier that you presented something? Yes, I did.
Starting point is 00:46:01 Okay. So on Wednesday and Thursday, there was something like a C++ track. So the most talks in one room or in one track were about C++. So, but yeah, that's it the
Starting point is 00:46:25 what did you present sorry again what was it that you presented at that track it was a story about how to determine the number of elements in an array
Starting point is 00:46:41 which is surprisingly interesting. So you just quickly, you all know this size of array divided by size of array element at zero thing. So, okay, it's not type safe and it's not nice. And I tried to improve it.
Starting point is 00:47:06 And that's what the talk was about. And it's surprisingly hard, I can tell you. Lots of template hackery to get there or something different? Yeah, it's a mixture of templates and constexpr. Okay. I came up with a quick solution. Interestingly, it's the same that meanwhile
Starting point is 00:47:30 is in the C++ 17 standard, but it does not work in all cases I came across. So I think I needed four or five implementations till I made it with all the code I know. I'm not sure
Starting point is 00:47:49 if it's really the rock solid version. Yeah. Okay. Well, Andreas, it's been great having you on the show today. Was there anything else we missed that you want to talk about with CBP Insights? Well, if you have bug reports, please file them. If you like to get involved, I would be happy with that. It's open to anybody, so I hope to get
Starting point is 00:48:16 a community behind this. I talked to a couple of people. I'm not really a Windows user, so if somebody can assist with the Windows support, that would be great. I think it should work, but I'm really not sure.
Starting point is 00:48:38 Oh, yeah. And for the merchandising part, I opened a t-shirt shop today. Oh, okay. I think it's probably the same you have to let people buy t-shirts with the CBP Insights logo on it. And the money could help to improve the infrastructure. Or if it really goes great, buy me a little bit of time to improve the project on my own.
Starting point is 00:49:07 But I'm not thinking so far. I think for infrastructure, it would be great. Okay, we'll make sure to put a link to that in the show notes. Yes, definitely. Wonderful. Okay, well, thank you so much for coming on today, Andreas. Thanks for having me.
Starting point is 00:49:24 Yeah, thanks for coming. Thanks so much for listening in 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 about that too. You can email all your thoughts to feedback at cppcast.com. I'd also appreciate if you like CppCast on Facebook and follow CppCast on Twitter. You can also follow me at Rob W. Irving and Jason at Leftkiss on Twitter. And of course,
Starting point is 00:49:51 you can find all that 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.