CppCast - STX
Episode Date: August 20, 2020Rob and Jason are joined by Basit Ayantunde. They first discuss a blog post on plain old data types and Visual Studio's Address Sanitizer support. Then they talk to Basit about the STX library. ... News No more plain old data AddressSanitizer for Windows: x64 and Debug Build Support Meeting C++ Online Tickets Available Links STX Basit's Patreon Sponsors PVS-Studio. Write #cppcast in the message field on the download page and get one month license PVS-Studio is now in Compiler Explorer! Free PVS-Studio for Students and Teachers
Transcript
Discussion (0)
Episode 261 of CppCast with guest Basit Iyantunde recorded August 15th, 2020.
Sponsor of this episode of CppCast is the PVS Studio team.
The team promotes regular usage of static code analysis and the PVS Studio static analysis tool. In this episode, we discuss plain old data types.
Then we talk to Basit Ayyantande.
Basit talks to us about the SGX library and other open source work he's done. Welcome to episode 261 of CppCast, the first podcast for C++ developers by C++ developers.
I'm your host, Rob Irving, joined by my co-host, Jason Turner.
Jason, how are you doing today?
I'm all right, except for this cloud hanging over me.
Of smoke, that is.
Yeah, what'sado like these days well it's just a bunch of forest fires it's standard you know wildfire season i guess out here
so uh it's uh the other day like i couldn't even see the yesterday i couldn't even see the sun at
like uh 6 p.m it was so dark with cloud with smoke are they like out of control
or are they fairly well controlled by the fire department i don't know i mean they had to
evacuate a few areas but it's all you know just kind of normal it's funny because i recently
tweeted about this i like you know just the extreme weather like this is just part of living in Colorado. We get blizzards, monsoons, wildfires.
We don't get earthquakes.
We do get tornadoes.
It's fine.
Okay.
All right.
Well, the top of Arizona likes to read a piece of feedback.
This week, I saw this tweet from Patrice Roy, who we've had on the show, I think, three times before.
I haven't talked to him in a while.
But he wrote this tweet saying,
Not commuting and working from home and working all the time makes my podcast backlog grow bigger by the day.
I miss listening to CppCast.
It's on my short list of must-listen podcasts.
And I saw this follow-up reply from Bjorn Fahler.
And he said when he commuted, he listens to a lot of fascinating podcasts, but now there's no
commute, so little listening time. Then an odd thing happened. Long lunch walks,
bicycle rides, whatever, and podcasts again. Only many aren't
airing some summer breaks, which I guess some podcasts take off for the summer.
Not us. Why don't we do that? Maybe we should do that.
I did kind of think about this, and that's something that i should really do i also you know don't listen to many podcasts anymore because i don't have that commute into the office which i
know you have not had for a long time jason like 11 years yeah yeah but i i should do more walks
or bike rides or something because you know that
commute time just winds up being more work time or just sitting around the house and i should
really be better about that yeah yeah well we'd love to hear your thoughts about the show you can
always reach out to us on facebook twitter or email us at feedback at speakass.com and don't
forget to leave us a review on itunes or subscribe YouTube. Joining us today is Basit Ayuntande. Basit is an undergraduate at the University of Eloran,
Nigeria, where he majors in mechanical engineering. Basit has four years of experience writing
industrial software, both as a contract software developer and intern. He is one of the C++ Now
2020 scholars. He contributes to open source projects like TensorFlow and CMSIS and authors
STX and a number of open source C++ libraries.
Baza, welcome to the show.
Thanks for having me.
So I've been curious about this because I saw on your bio, yeah, that you, a C++ Now 2020 scholar, we didn't talk a whole lot about C++ Now because, well, it was canceled this year, right?
So were you planning to come to Aspen?
How did that all work out?
Yeah, I was planning to come
but the conference
was cancelled. I was even about preparing for my
visa and stuff.
It was cancelled so
I disrupted my plans.
That's unfortunate.
I'm kind of curious, you're majoring
in mechanical engineering but you've done so
much software development work.
Are you learning C++ as part of your curriculum in mechanical engineering, or is that just
something you became interested in on your own?
I actually became interested in it on my own during my first year.
That was when I started learning C++.
Very cool.
The last engineering program that I was really familiar with,
everyone had to learn Fortran in their first year,
which just makes me sound old.
I don't know if that's still true or not.
Actually, I did some C programming in my second year,
but it wasn't really intensive.
Right.
All right, well, Basit,
we have a couple news articles to discuss.
Feel free to comment on any of these
and then we'll start talking more about
your STX library and some of the other
open source work you've done, okay?
Alright, so the first
thing we have is this blog
post titled
No More Plain Old Data.
And it's all about plain old data
or pod types and uh how the you know the
feature to you know do the type trait to detect a pod type is actually being deprecated in c++20
which is i don't think something we've talked about before but there are now the type traits
for is trivial and is standard layout uh and you know the concept of pod types are kind of going
away i guess but you can think of a pod type
as both a trivial and standard layout type,
and that's what this blog post is basically going over.
Lots of good examples in this one.
I found it pretty helpful, actually,
because when I saw that the is pod
was being deprecated in C++20,
I'm like, really?
Why do they take the nice things away from us? But this
article gives enough background for it to really
make more sense. Yeah, definitely.
Do you have a chance to read through this one, Basit?
Yeah, I'll also read through it.
I think it's
a very good idea,
separating the
trivial and POD types,
because basically those PODs are more
like trivial types, but it's really
very constrained
constructors.
Next article we have
is from the Visual C++ blog.
This is about the address
sanitizer support in Windows
with Visual Studio. We've definitely
talked about this one before, but they
keep adding and expanding on
the address sanitizer
functionality in visual studio and it now supports x64 i believe when it first started it was just
for x86 it also has debug build support and this is a really good post if you do want to try out
the the visual studio address sanitizer because it goes over how to set it up properly, what some of the known
issues are, and just seems like a really helpful post. I know I did try this out when I think it
was first announced and I had some trouble, but I'll have to take another try at it now that
they've added x64 and debug and see if I can have more success with it now. This will be a little
bit of a mental shift for me
because, I mean, for so many years now,
I've been using Visual Studio, and I'm like,
you know what, I really need to run this through Agile Sanitizer.
All the projects that work on our cross-platform anyhow.
So I just run it in Linux.
You know, I have to remind myself,
wait a minute, I should be able to actually do this in Visual Studio now.
I also like this comment. I just want to point out that they said,
we have fixed bugs in our tools thanks to customers who were early adopters and
building large internal systems like Office. I think running
Office with address sanitizer probably counts as an effective test.
Yeah, definitely. That's a big product.
That's a very big product. Yeah. yeah bazza do you have a chance to
use this and are you a visual studio user or a linux user linux okay all right uh and then the
last post we have is meeting c++ 2020 and uh there's now a list of accepted talks and definitely
a couple changes uh to the conference this year, which I guess we should expect.
They're going to a single track as opposed to, is it normally three or four tracks?
There's four tracks over like three days.
This looks like a single track over, actually, I don't know how many days it's over.
It's 11 talks.
So it's definitely not one day.
I don't think so.
Yeah. it's 11 talks that's definitely not one day i don't think so yeah yeah uh but single track now and there are going to be options to buy online tickets and i believe
the plan is to still have some uh in-person conference goers but it'll probably just be
you know local people in berlin uh you know We still have to worry about COVID,
even though I think Germany's numbers are fairly low these days,
which is good.
Yeah, I can't go.
At least not at the moment.
No, I mean, we're not even allowed to travel there at the moment.
Yeah.
Yeah.
All right.
Basit, we've mentioned a lot of open source work that you've done in your bio.
Could you start off by telling us about your STX library?
Yeah, sure.
So STX is a set of error handling and utility extensions to the C++ standard library.
It was primarily intended to address a few shortcomings or features that we feel would be nice to have in C++.
So we have libraries like the monadic optional and error-undue libraries and the backtrace library,
which actually make working with C++ easier.
Right.
I was planning to ask about that because I did notice you had your own optional implementation in there.
And I'm like, well, optional isn't C++17.
So what makes your optional implementation different?
The primary concern was with C++ exceptions, especially if you're in the operating systems on the base system side.
So it would be a big drug for you our optional type uses the feel-fast and customizable
abandonment mechanism that we call panic so with my experience in the system software it is much
much more desired also on two chains like extensor you don't really even have a standard exceptions mechanism. So it can even be very heavy for some embedded systems platform.
Okay.
Can you tell us a little bit more about...
I'm sorry, go ahead.
Okay.
With the monadic operations too, you can like...
With the error handling logic, you can separate them as in pipelines
instead of writing them manually.
So it actually makes even error handling easier
than std optional.
Yeah, I was recently working with optional myself
and thinking that felt like a lot of boilerplate
to be like, if this, then do this operation.
If the optional's not set,
then do this other thing or whatever.
So the monadic operations...
Go ahead.
Steve Brown wrote a paper about that
for sts optional.
Right.
I haven't really been tracking its progress.
Yeah, I know that there's
I have no idea what the progress is
on getting that standardized.
Me too.
Can you tell us more about the panicking?
I don't think I've heard of other libraries with...
It says runtime panic hooks.
Can you tell us a little bit more about that?
The runtime panic hooks are like customizable hooks.
Hooks are like runtime mechanisms
that used to customize behavior or functions.
So you can...
If you want the library to like feel
fast abort you can set it to abort the panic instead of like causing your program to like
immediately terminate it to just abort instead if you want to see to log to disk to log to disk
instead before terminating so it gives you because there are some mission-constrained
platforms. For example,
the Mars rover, if you are launching
into space, you don't necessarily just
want it to abort mid-space,
mid-mission. You might
want it to log to disk so you'll be able
to fetch the reasoning for the abort
and other error reports. So you can do that
with the panic hook.
Assuming you have any behavior you want,
once an error occurs, you can do that
with the panic hook.
Is it like a global
handler, like
set terminate or whatever,
like that kind of thing?
Yeah, exactly.
Both results and
optional, you report to it.
Interesting. Is this library
only for C++
20 or could you use it with earlier
versions of the standard?
Initially, we had C++
20, but we had to
remove some C++ 20
features like the concepts
and some other
C++ 20 specs features from it. Most of our users some other C++ 20-space features from it.
Because most of our users were using C++ 17.
I'm still kind of curious about your panic handler, and I'm curious if it's like thread
safe or what happens in like a multi-threading situation if the panic handler is called.
Yeah, it's actually trace-safe. We intentionally made sure that it's an atomic
operation, so all the interactions with the panic handler are atomic. Neat. Okay. Now, I've got the
documentation up on my screen here, and it looks like you are not afraid to use constexpr. So is constexpr supported throughout the library?
It's just for the results and
option type non-tragular here.
You also mentioned backtracing here. Is that
to produce stack traces so you can debug what went wrong in the case of a
panic? Yeah, that's for the panic handler. So once you can also customize the panic book to give you a
detailed backtrace on the planning purpose. You know, for example, if you have a six segv,
you can, especially for beginners, it's very difficult to trace exactly where it's occurred.
So the backtrace library can use it to know where the sigv occurred,
which is the reference in null pointer or an invalid pointer.
So it's actually very useful for that purpose.
So you said you're a Linux user when we were talking earlier.
Does the library support Windows by any chance?
I have some of our contributors have tested on Windows,
so I'm very sure it works.
I also have test sites for it on Windows.
Okay.
So you just mentioned signal handlers.
That sounds like something I don't think can work on Windows.
And I just realized at this moment,
I've done all kinds of signal handling code on Linux.
I've never even concerned myself with the question on Windows.
I have no idea.
So do you know what that story is?
I know you said your contributors have worked on that,
but is there signal handling type code for Windows as well?
Yeah, it's cross-platform.
Okay.
It's usually a serial runtime,
so there isn't really a problem with that.
Okay.
And backtrace, similarly, does it work across platform?
Yeah, both Windows and Linux only.
Okay.
Okay.
I also noticed your library looks like it's got some awesome documentation.
It looks pretty clean if you look at the generated documentation you have.
And I was curious what you're using to generate your documentation.
For your documentation, I'm using Doxygen.
Okay.
I've heard some people complain.
Oh, sorry. Yeah Doxygen. Okay. I've heard some people complain... Oh, sorry.
Yeah, you can go on. I heard some people complain that Doxygen isn't
really keeping up with C++17 and
C++20, and I haven't used it myself
a whole lot lately,
so I was curious if you ran into any of those
problems. Yeah, it's
not up to date with C++20,
but I didn't run into an issue with
C++17 support.
The only issue I ran into for C++20 was with the concept type.
So it treats concepts as variables.
It actually gives good documentation, although it's not really adequate source level information.
I also tried ClangDoc and various other documentation
tools, but they didn't really give
me the right amount of
source level documentation as
Doxygen. That's interesting. I don't think
I've ever heard of ClangDoc.
It's still a work in progress.
It's not yet complete.
Okay. Do you know, is it...
It's Clang11.
Is it... Yeah, is it part of Clang? Oh. Clang11. is it? It's Clang. It's Clang 11. Is it, yeah, is it part of Clang?
Oh.
Clang 11.
Who knew? There's always some new tool to learn about in the Clang suite of tools here.
Yeah.
Today's sponsor is the PVS Studio team.
The company develops the PVS Studio Static Code Analyzer,
designed to detect errors in the code of programs written in C, C++, C Sharp, and Java.
Recently, the team has released a new analyzer version.
In addition to working under Windows, the C Sharp part of the analyzer can also operate under Linux and macOS.
However, for C++ programmers, it will be much more interesting to find out
that now you can experiment with the analyzer in online mode on the godbolt.org website.
The project is called Compiler Explorer and lets you easily try various compilers and code analyzers. This is an indispensable tool for studying the capabilities of compilers.
Besides that, it's a handy assistant when it comes to demonstration of code examples.
You'll find all the links in the description of this episode.
Basit, how long has the library been available? And you know, are there any, you know, are there any applications using it in production code?
It's been available for three months now.
So I've not been up to date with the community
to even know which projects are using it or not.
But we have a very small user base for now.
I still experiment and try to add more features.
Okay.
That's pretty good.
278 stars already on GitHub for a project that's only a few months old.
Yeah.
So are there any other features of STX that you would like to mention
that we have not talked about yet?
Okay.
About the Docs Engine documentation,
I had to write some JavaScript and HTML and CSS
just to get a very meaningful documentation
that's readable prior to the other messy one.
Okay.
Oh, I did notice that you're using Abseil,
and I'm curious what features of Abseil you're taking advantage of
yeah so for the
backtrace library
the STX backtrace library is
more of a wrapper around Abseil's
backtrace library
which is
Abseil's backtrace library is very low level
very
can be quite difficult to deal with.
SX is just
around Abseil's backtrace
library.
I didn't even realize Abseil provided
a backtrace library.
Yeah, I don't think I knew about that either.
For the backtrace libraries,
I've tried quite many.
I've tried LibOnwind.
I've tried LibBackactress and many others.
That's interesting.
I mean, we just had the author of LibBactress on two episodes ago.
Oh, yeah, me and Taylor.
Yeah.
It's easy to see on the web, too, which makes it very difficult to do it.
Okay.
So you give a much more high-level C++ kind of access to a backtrace reporting then.
Yeah.
I wanted to ask about some of your other open-source work.
You have done some contributions to TensorFlow, is that right?
Yeah.
Can you tell us a little bit about what you've done there?
TensorFlow on projects they were there with this arm cortex and protect processors
They have this specialized sendy and address related infrastructure assets I mean to which we are trying to take advantage of or to playing computations
For this really really constrained embedded devices. So it was really an exciting opportunity that will bring a lot of value to businesses and
people.
So my contributions were to implement some of these kernels and computation graphs that
were used to run all these tiny devices.
So yeah.
Okay.
So is that TensorFlow or TensorFlow Lite?
I think we talked a lot
about tensorflow light
when we had
Andrew Sully on the show
yeah
they are not
tensorflow light
micro
it's called
tensorflow light micro
tensorflow is
divided into
tensorflow
tensorflow GPU
tensorflow light
and tensorflow light
micro
oh okay
a lot of tools
going in here
so many variations
are there any other libraries you contributed to that you want to talk about Oh, okay. A lot of tools going in here. I know, so many variations.
Are there any other libraries you contribute to that you want to talk about?
Yeah, I also contribute to CMSIS.
The CMSIS I mentioned earlier.
Right, can you tell us a little bit more about that, CMSIS?
Yeah, so it's also like a backend for TensorFlow,
which is the one that actually runs the computation.
So these are mathematical operations.
They're also for the SIMD instructional sets. So it's more closely tied to assembly.
So we use the SIMD instructional sets
to perform the computation on it.
So the statistical and analytics function
just write them for the platform.
Well, I do notice here also on your GitHub
that you've got several small projects
that are related to hardware.
And this seems to then also tie into
what you were just talking about
with your contributions to TensorFlow.
It seems you have an interest in this low-level,
small hardware kind of thing.
Yeah.
I've been trying to learn more about operating systems
for about two years now.
So I basically started from writing drivers,
so very low-level drivers.
I've been writing them for small, tiny platforms.
So you said you're currently majoring in mechanical engineering. How far into your degree are you?
I'm in my penultimate year now.
Okay.
Four or five years.
So no chance you're going to switch to computer science at this point, probably.
No, at all it does sound like you do have a really deep interest in hardware operating system c++
that kind of thing yeah okay uh i know you had an internship at goldman sachs over the summer
i wanted to ask how that went yeah that was a really really big opportunity for me. I got to learn about the finance sector and how to write software.
It's totally different from the normal developer-facing software.
Do you have any recommendations for people who are looking for internships? I think the biggest recommendation I have
is not to give up
because rejection is part of the process.
I spent about two years
searching for internships
and I can't really find any.
And the best people you can find,
you can reach out for help
is your network.
You have to try to meet more people. You never can tell out for help with your network. You never try to meet small people.
You never can tell who can help you.
And was this an internship that you participated in remotely
or did you go to a Goldman Sachs office during this time?
Remotely.
Oh, okay.
Was it only remote because of the current conditions with the pandemic
or would it have been remote either way?
Yeah, it's a pandemic. It's normally 10 weeks, but we spent five weeks in a pandemic.
So you are definitely the first guest we've had on who currently lives in Africa.
Was your location in Nigeria at all a problem
or an extra hurdle in trying to
find an internship?
That was my
biggest hurdle.
The problem wasn't really
finding an internship,
but finding people to sponsor
you out of the country
or have you do it remotely.
That was the biggest order for me
and most people most people don't want to air from nigeria because they have this
impression that most nigerians are fraudsters and all those kind of corrupts yeah so
so it's really really difficult i'm glad you're able to get one. Yeah. So when you had been accepted for coming to C++ now,
had you already gotten whatever visas you would have needed?
Yeah, it was terminated.
My application was terminated.
You know, Trump, I think he ended in law
that they should stop issuing J G1 visas or something.
So my visa application was terminated then.
Oh, okay. That's unfortunate.
Hopefully we can try again next year or something.
Yeah.
Do you hope to be able to come to some of the C++
conferences next year, or are you going to try to apply to them?
Yeah, I do hope to. I'll try
to apply again next year.
I'm looking forward to it.
Hopefully I'll
be there and we can actually meet in person.
I also,
back to your open source projects,
I did notice that you have a Patreon.
Is that right? Did I get that right?
Yeah.
All right, cool.
So, you know, people can contribute to your help, encourage you to keep working on these projects, I assume.
Yeah, sure. I would really appreciate that.
All right.
Very cool.
Is there anything else you'd like to go over before we let you go
boss it um none for now okay all right well it was great having you on the show today uh
definitely keep up the good work i'll encourage listeners to check out stx and check out your
patreon uh to help support your ongoing development definitely thank you make sure we have links to
all that yes make sure we have links to all that.
Yes, make sure we have links to all that.
And where can people find you online?
I know you're on Twitter a lot, right?
So what's your Twitter handle?
Basit.
Very cool.
Make sure we have a link to that as well.
Yeah.
All right.
Thanks, Basit.
Thanks for coming on.
That was great.
Thank you.
Thank you.
It was nice.
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.
We'd also appreciate if you can
like CppCast on Facebook and
follow CppCast on Twitter.
You can also follow me at Rob W. Irving
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 slash CppCast.
And of course, you can find all that info and the show notes on the podcast website
at cppcast.com. Theme music for this episode was provided by podcastthemes.com.