CppCast - foonathan/type_safe and more
Episode Date: February 1, 2018Rob and Jason are joined by Jonathan Müller to talk about his experience at University and some of his recent projects. Jonathan is a CS student passionate about C++. In his spare time he wri...tes libraries like foonathan/memory which provides memory allocator implementations. He is also working on standardese which is a documentation generator specifically designed for C++. Jonathan tweets at @foonathan and blogs about various C++ and library development related topics at foonathan.net. News GCC 7.3 Released C++ Tip: Erase-remove Idiom Revisited Beast: A Non-Traditional Source Code Review Inclusiveness, accessibility and CppCon 2017 videos Jonathan Müller @foonathan foonathan::blog() Links type_safe library cppast library Jonathan Müller's Patreon Sponsors Backtrace Embo++ Hosts @robwirving @lefticus
Transcript
Discussion (0)
Episode 136 of CppCast with guest Jonathan Mueller recorded January 31st, 2018.
This episode of CppCast is sponsored by Backtrace, the turnkey debugging platform that helps you spend less time debugging and more time building.
Get to the root cause quickly with detailed information at your fingertips.
Start your free trial at backtrace.io slash cppcast.
CppCast is also sponsored by embo plus plus the upcoming conference will be
held in bocom germany from march 9th to 11th meet other embedded systems developers working
on microcontrollers alternative kernels and highly customizable zero-cost library designs
get your ticket today at embo.io In this episode, we talk about GCC updates and a code review of Beast.
And we talk to returning guest, Jonathan Mueller.
Jonathan talks to us about his experience
in university and some of his new projects. Welcome to episode 136 of CppCast, the only 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 doing pretty well. How are you doing, Rob?
I'm doing okay. No real news for me to share. Do you have anything coming up soon?
No, I did just get back from training that I did in Bellingham, Washington.
It was pretty fun.
I was set up by Faithlife, which is a small company up there.
Well, actually, it's a large company in the area.
And they opened it up to anyone in the community who wanted to come,
also through their local meetup.
So that was a fun C++ seminar that I did for a day.
Nice. Did you have many people taking them up on that offer from non-employees coming in?
Well, 10 people signed up on the meetup page and one person showed up.
But I still thought it was a great idea that they did that.
Yeah, it's a nice idea. They just need to publicize it a bit more i guess well it's also like i said a small community sure sure okay well
at the top of her sort of like to read a piece of feedback uh this week i saw a tweet uh from izzy
who we had on late last year and she said that she's been planning on getting this all set up
for a few months now but decided that she's going to start developing the build system slash package manager
that she announced on the podcast live on Twitch.
So she's trying to get her network set up correctly,
but she's going to, I guess, start live coding this new build system on Twitch.
That's pretty cool.
And I hope she goes through with that and starts working on it soon.
Yeah. pretty cool and uh you know i hope she goes through with that and starts working on it soon yeah and i hope she gets her um issues sorted out with buffering and such that it's she says on there because uh last time i tried to play with the live streaming stuff like my audio would
get out of sync after about 45 minutes i don't know why that'd be pretty frustrating yeah yeah
well if she uh does go through with this and start doing it, we'll definitely share links to her Twitch stream on the show.
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 emails at feedback at cpcast.com.
And don't forget to leave us a review on iTunes.
Joining us again today is Jonathan Mueller.
Jonathan is a CS student passionate about C++.
In his spare time, he writes libraries like
Funathan Memory, which provides memory
allocator implementations. He's also
working on Standard Ease, which is a documentation
generator specifically designed for
C++. Jonathan tweets
at Funathan and blogs about various
C++ and library development-related
topics at Funathan.net.
Jonathan, welcome back to the show.
Welcome.
Thanks for having me.
Sure.
So have you been having fun at university since you started, since we last talked?
Yeah, I'm having fun.
It's fun as well.
It's hard stuff.
The math part is really hard, but I'm having fun, yeah.
Oh, very good. Well, we'll talk more about that when we actually get into the interview.
Yeah. Well, we have just a couple of news articles to discuss. Obviously, feel free to comment on any of these, Jonathan. Then, like Jason said, we'll start talking more about what you've been up to lately, okay?
Okay. Okay, so this first one is GCC 7.3 has been released.
And the big takeaway here is that their latest update
does include options to mitigate Spectre Variant 2.
That's specifically for x86 and PowerPC targets.
Right.
They also did fix 99 other bugs, though.
Right.
Mostly a bug fix release.
Mostly a bug fix release.
One of them stands out to me.
What would that be?
Temporary object created as a default argument not destructed.
Anything that says a destructor might not be called is a terrifying bug to me, given that this is C++.
Right.
Right.
That's pretty important.
I'm glad they were able to get that fixed.
Anything stand out to you, Jonathan?
Yeah.
No, no.
Okay.
Okay.
Okay, next article is on Code Project, which I thought was interesting to see that people are still putting new
things on code project,
but this is the erase,
remove idiom revisited.
Jason,
do you want to talk about this one?
Sure.
I mean,
I checked this out and I think the main thing about it that I found
interesting was apparently Arthur O'Dwyer,
who is a regular speaker at conferences. We've not had him on the show, correct?
No, we haven't. And I noticed he was mentioned here too. I didn't realize he wrote a book on
the STL. Right. So he recently wrote a book,
Mastering the C++ 7 STL. And apparently he's got an unstable remove proposal for the standard
that could potentially make the remove algorithms much
faster if you're not worried about keeping the relative ordering of things when you use the
remove idiom, which I guess I didn't describe, but I could.
Yeah, go ahead.
So the erase remove idiom, or if I, yes, you run the algorithm that you want that's going to remove a bunch of things.
And what it does is it orders them all at the end of the list, then returns back to an iterator of the first thing that ends to actually be erased.
And then you call erase on your container, and then it just deletes the tail of it.
And this is to solve the problem with iterators being invalidated when you erase something from the middle of a container okay yeah that definitely sounds useful yeah we
should uh try to get arthur on the show and talk about his proposal in his book sure uh the unstable
remove thing um it reminds me of a container it It's called bag or something. This is basically a
wrapper of a vector, but all of elements doesn't matter. It just matters whether or not an element
is inside. And the erase operation of it is exactly that. It simply swaps it with the last
element and does a popback because the order of the elements inside the container doesn't matter.
Interesting. So how do you actually, I don't know, find an element or whatever?
You don't find it.
It's just like you have a list of things,
and later you want to iterate over all of them.
Okay.
But you don't really care about whether or not
you just want to have a collection of things.
So effectively, all the operations on it are unstable operations.
Yeah, yeah, yeah.
Insert is just a pushback, and erase is just a hopback.
Interesting.
Yeah. Insert is just a pushback, and erase is just a popback. Interesting.
Next thing we have here is a non-traditional source code review,
and this is in reference to the Beast library that we talked with Vinny Falco about a while back.
Apparently, he submitted the library to get reviewed by this company, Bishop Fox,
which I had not heard of before, but i guess they do security reviews and he had them do a security review of beast and uh they found a couple flaws which he went ahead
and fixed prior to that library going into boost uh with its 1.0 version and he went ahead and
published all their findings which is interesting to see yeah for, for sure. It's neat when companies get involved in the open source world like that also.
Yeah.
And then, do you have something to say, Jonathan?
No.
Okay.
And then the last thing is this article on CppCon 2017,
Inclusiveness, Accessibility in CppCon 2017 Videos.
And two major announcements here.
One is that they just finished uploading all the CppCon 2017 videos onto Channel 9.
They had already been on YouTube for a couple months, obviously.
But now you can get them on Channel 9, too.
And the nice thing about that is Channel 9 allows you to do offline viewing.
You can just download the whole video, which is great.
And then the other announcement is they have now closed captioned all the video, professionally captioned them.
So when you're looking at YouTube, you'll see professional captions, not just the auto-generated ones.
So it's really great for anyone with hearing problems. There's also the fact that YouTube is blocked or restricted in some countries,
and Channel 9 is restricted in fewer countries.
So it makes the CppCon videos more widely available.
Yes, absolutely.
Okay, I think that's it for the news.
Jonathan, can you tell us a little bit about how C++ is being taught at your university,
what your experience has been like so far?
I study at the RWTH in Aachen, and I picked it because it's a very theoretical university.
It's not really practical, so there aren't really any programming lectures at this
university there's there's obviously one in the first semester it's a lecture called programming
and they cover java haskell and prologue oh wow and there's the first method there they teach you
programming and then in the second semester you have a course about operating systems
and then you have to do some c for the
exercises so they give a two-hour introduction into c and that's basically it and then the third
semester semester i just finished um and we had to program a microcontroller in c for a couple of
weeks and for that we basically had to learn C ourselves completely so they didn't really teach us only the microcontroller stuff
I figure a two hour lecture should be
pretty much enough to become an expert
in C
I mean it's not C++
I am curious
what microcontroller architecture
they had you working with
It's a 16 bit microcontroller i forgot exactly okay
what's it's called but it was fun we had to do like scheduling work and implement a malloc and
stuff like that so did you go for this university which you said is you know they teach mostly
theoretical classes did you go for that because you already had such a good foundation in C++?
Yeah, I didn't want to go to university,
and then they have four lectures about advanced Java programming techniques
and stuff like that.
I don't really care about that, so I picked it, yes.
It's a heavy focus on math and theoretical computer science
and things like that.
So I guess we should maybe back up just a moment.
How long have you been in university now?
The third semester just ended.
Third semester just ended. Okay, right.
All right, so you're starting your fourth semester soon.
Yeah, first the exam, then the fourth semester in around April.
Okay.
What kind of experience do you think the other students are having?
Do you think you're kind of a common case where you came in already knowing at least
one programming language pretty well?
Or are a lot of students having to self-teach themselves while learning all this theoretical
stuff during their class time?
Most students had computer science at school
and then
there they learned Java, mainly
some Pascal, so
they know something about programming, but
mostly they had to teach CELS,
mainly C, for the
third semester.
It's been a really long time
since I was in school.
What is... You said computer science classes in secondary school, right? You know, it's been a really long time since I was in school.
You said computer science classes in secondary school, right?
Yeah, secondary school.
So did you take any of those classes also?
I did. We did stuff in Pascal.
That surprises me.
Yeah, the last year where it was allowed,
and the teacher didn't really want to do Java, so he used Pascal, and we were the last year where it was allowed and the teacher didn't really want to do java so he used pascal and we were the last year now that he has to do java that's interesting
so it's just like pascal so it's kind of funny i've heard things about his yeah well anyways
sorry maybe we shouldn't get into that. Yeah.
So you would say that the German computer science secondary school classes are good enough preparation for a computer science programming that you would need in a theoretical discipline like you're starting in?
Well, they spent enough time on the basic concepts of programming that you don't get completely lost in the lectures, but it's still a different level.
Okay.
Right.
That makes sense.
The same with math.
I mean, you know how to integrate something, but the lectures are a completely different level of, so, yeah.
Right. And the classes you took in high school, were those considered elective classes or was the majority of students taking some type of programming course?
What do you mean exactly?
Elective as in an optional class that you took during high school as opposed to being part of the curriculum.
They counted as a natural science, so most of them just picked them because they didn't want to have physics or chemistry or something yeah yeah i've always wondered if it
should count as a foreign language requirement instead of a science requirement yeah well
it would have definitely helped i think for some people if they could get rid of English or something and think that.
Well, I say that having taken German when I was in high school, but I did pass those classes.
Don't test me on my knowledge, though.
So what are your other classes like, these theoretical classes?
Are you learning about modern techniques,
or is it more abstract concepts like I think you said, operating systems?
Yeah, we have four kinds of lectures.
We have the practical programming ones, the theoretical computer science, the technical computer science, I think it's called, and math.
The practical programming, they were like the programming lecture,
and then the second semester, there were data structures and algorithms,
things like that.
And then the third semester, we had a lecture about UML diagrams,
which wasn't that interesting.
But the technical programming, we started with the electronic stuff
of computers and logic aids,
and the operating course was in that department.
So next year, I think, it's networking and internet lecture, mandatory.
And in the theoretical computer science,
well, you have complexity and term machines and regular languages
and things like that, rather than you have math.
Always in the math. Yeah, it you have math. Always in the math.
Yeah, yeah.
It's a heavy math.
It was nice.
I recently bought Elements of Programming.
And I knew everything of the math side from my first semester lecture.
I also own Elements of Programming.
However, it had been at least 10 years since I was out of university
before I picked up the book and I look at it and I say, this is going to take more work than I wanted to take.
Yeah, for me it was a nice week because I was familiar.
I had this, I had that.
It was a really hard first semester lecture, but it was totally worth it.
Good.
That's good.
How's it been going to some of the conferences as a student volunteer and speaker?
It's great. I can only recommend it. It's amazing. I want to go to as many as possible. It's just great.
So what conferences did you go to last year?
Last year I went to CPP Now and Meeting C++.
Okay. And what's the experience like as a student
volunteer? I mean, what do you
do? What are you required to do?
At CPP Now, as a student volunteer, well, we
had to do, like, set up things
before the conference. We put the names
and the badges and stuff like that
and carry things around.
And then during the conference, we had to
hold up the signs or help with
the food preparations.
It's not too much work.
Okay.
When you were kind of wearing two badges since you were also speaking, right? Yeah, yeah.
I was also speaking.
It was a little weird because a lot of people coming knew me and so uh so when you when you do that does the
conference pay for your hotel travel whatever uh it varies from time to time uh this year for
example at meeting c++ they paid for um the hotel but i had to pay for travel which wasn't
it's just a train ride but last year i had to pay for a hotel myself, and this is sort of problematic because the hotel is really expensive.
I'm a student, so...
But in C++ now, the hotel...
In C++ now, they pay everything for the volunteers if you ask them,
which is great.
Yeah, this sounds like a great commercial at this point.
If you're a student and you're listening
and you haven't signed up for the volunteer program,
maybe you should do that.
I don't think it's open.
Yeah, it's not open yet.
They just closed the call for submissions.
Did you submit a talk?
I submitted a talk, yes.
Okay.
And I also have a talk at ACCU coming up.
Okay, and so that one's definite because ACCU is very soon, right?
Yeah, I'm on the schedule.
I'm like Wednesday at 4 also.
What are you doing a talk on?
I'm talking about pointers and references
and optional references and string views
and when to use which one and why not the one
and what's about byte and all this kind of stuff.
I think you, at some point,
oh, it's been a while now,
wrote an article raising awareness
to the fact that string view can easily create a view of a temporary.
Yeah, yeah, I'm talking about this kind of stuff.
Basically, like, do we need an optional t-ref or is this just a pointer?
Do we, things like that.
It was an explicit decision from the committee to not allow optional references, right? Yeah, because of the assignment issue,
what should an optional donor assign to the reference or rebind the reference?
Because references are kind of weird.
But let's say we figure that out.
Should we still add it, or could we just use a pointer?
I mean, because an optional reference
is a pointer with a special value,
so what's really the difference
in elaborating on that semantic aspect of
Well do you want to give us a preview as to
what you are going to say?
Yeah for example
I'm basically going to analyze
the different properties the objects have
so like a pointer
a reference and then I'm going to look at
various situations where we might want to use
one over the others
for example in my opinion I think we need an optional tree reference
for semantic purposes, because it has a different semantic meaning than a pointer.
But I'm going to elaborate much more on that in the talk.
So you think we do need it, but how does that then compare to an optional reference wrapper?
Yeah, that's also a reference.
Yeah, this is the kind of questions I'm going to answer in that talk.
Okay.
I mean, I can go on here, but then we'll get sidetracked and talking about references.
I don't know whether that's the point.
Well, you know, it's just an interesting topic.
So if there's anything else you want to add about it, or we can move on.
Yeah, I think it's a great talk.
I've also submitted something similar to C++ now,
but on the higher level of C++ now.
This is HCCU is more for like a guide we try to use.
And then at C++ now, I want to talk about the underlying concepts a little bit more
and things like, yeah, so more at the c++ now level
than at acc yeah i uh it seems like a lot of talks at c++ now end up kind of almost with like uh the
committee needs to take an action here kind of by the time you're done with your talk this is what
needs to change in the language yeah yeah or something yeah i
wanted to interrupt this discussion for just a moment to bring you a word from our sponsors
backtrace is a debugging platform that improves software quality reliability and support by
bringing deep introspection and automation throughout the software error life cycle
spend less time debugging and reduce your mean timed resolution by using the first and only
platform to combine symbolic debugging,
error aggregation, and state analysis. At the time of error, Bactres jumps into action,
capturing detailed dumps of application and environmental state. Bactres then performs automated analysis on process memory and executable code to classify errors and highlight
important signals such as heap corruption, malware, and much more. This data is aggregated and
archived in a centralized object store,
providing your team a single system to investigate errors across your environments.
Join industry leaders like Fastly, Message Systems, and AppNexus
that use Backtrace to modernize their debugging infrastructure.
It's free to try, minutes to set up, fully featured with no commitment necessary.
Check them out at backtrace.io slash cppcast.
I wanted to ask about this blog post you wrote a couple months ago
after meeting C++ 2017 about what should be part of the standard library.
And you wrote this kind of in response to the graphics 2D proposal
that was discussed at meeting C++.
Yeah, Guy Davidson gave a talk at meeting c++ about the
2d graphics proposal and he sort of addressed because i mean when you give a talk about it
the obvious question is why should we put graphics in the standard library and he talked about it a
little bit it's something nice for beginners you don't have to do console applications but you can
simply do graphics or maybe things like pdf output
someone brought up where you don't really need to have that this much performance because obviously
if you're writing a game a high level game you wouldn't really want to use it you use a
specialized engine because it's not fitted for your kind of hardware usage.
So this whole discussion got me thinking about
what should be part of the standard library,
because this is based on a world
where we have a perfect package manager
and it's no problem to install an external library.
Then we can get rid of the,
yeah, well, it's too convenient.
We need it all the time.
So it needs to put in the standard library
because it's just a pain to get this external library
in every program where you want to use a vector, for example.
So we can sidestep that issue.
And then in theory, I mean, you wouldn't need anything
in the standard library.
But then, for example, you have code dealing with strings.
And then every project, there are probably multiple competing string libraries.
And then you have this library that uses this string library.
And then you have the other library using a different string library.
So you want to integrate them both in your program.
And you constantly have to convert between the strings back and forth in your own program. So it would be really
great if there was like a vocabulary
string type in the standard library
because then everyone would have a common
interface. And this
wouldn't even need
to be a standard string.
Standard string would be enough for most
cases because then we'll have like this
is a string, we can pass it around and
things like that. So this is what i talked about in the block was that standard library in this perfect world really
should only contain the general vocabulary types needed to have a common right so your point is
that getting the standard vocabulary types out of something like a graphics library like a standard
point yeah kind of more
important than having the graphics library itself as part of the standard yeah yeah it's it's really
i think the better value of the 2d graphics is not like here we can use this implementation to
end the things but like the this is a point this is a color that you can maybe use in a different
engine that is more optimized for your use case.
Okay.
I find myself wondering,
because there's been talks at CppCon now,
excuse me, CppCon, about this,
where Facebook has their own strings implementations internally because they've got their requirements
and they need to trim a billionth of a microsecond
off of each operation.
And then, you know, you talk to some game programmers and they're like, well, we have to completely reimplement the STL because it doesn't meet our specific requirements.
And I totally agree with you.
I like the idea of having this common vocabulary of points and whatever, I wonder if the main people who would want to use that vocabulary would be like, well, your point
is less efficient than
my point because it uses one extra bit
than it needs to, so I'm going to
reimplement it and, you know,
I don't know. I'm feeling slightly
cynical about this, I guess.
What do you think?
Well, I think for
something like, yeah,
okay, it's not even as simple as a point because
we use float, we use double, we use integer coordinates, so this is the whole issue.
But maybe a string view, I mean, it's just a pointer and a size.
Well, unless you want a null terminated string view, then it's just a pointer.
So, yeah, it's a difficult problem.
But I think there's something enough for 90% of the use cases,
and the remaining 10%, they just use their own.
So I think that's good enough.
So outside of agreeing that there should be a vocabulary
for some of these 2D graphic things like there is for strings,
do you see other parts of the standard library
where we could use a common vocabulary, that we need one, that is.
So you mean
what are vocabulary types
currently missing in the standard library?
Right.
Is that what you're asking?
Well,
I can't really think
of any off the top of my head.
That's fine.
Yeah, maybe
like a streaming reading the top of my head. That's fine. Maybe like
a
reading interface that's not
standard stream of boot business.
A lot of people don't like
IOS streams, that's for sure.
Yeah. I mean, I remember
reading the book about IOS streams
and was amazed a couple of years ago
about what they can do and how they're designed
and the local stuff, but
I get why people don't like it
nowadays.
When we had you on the first
time, I think we mostly talked about
your standardese and memory
libraries. Do you have any other newer
projects that you want to talk about?
Well, out of
standardese, I a libclang to
pass the source files and generate the synopsis and i quickly found that that libclang isn't that
well maintained compared to the other clang tools so it only provides a limited interface and
couldn't give me all information for example didn't give me the full no-accept expressions of a function.
So for those, I just went ahead and got the tokens and manually looked for a no-accept in there and passed that,
if that was the case.
And then there were also, like, well, they're not really bugs,
but inconsistencies in the APIs, so I had to work around those.
And quickly, the passing code became, like, so complex.
I had to work around for this issue the parsing code became so complex.
I had to work around for this issue and how do I get this and this was a lot and a lot of work around.
I think last summer I decoupled all that parsing code into a separate project,
CPP-AST.
It's basically a high-level wrapper over libang, but I designed it completely agnostic,
so I've defined a separate est, and then I simply use libclang to build the est, but
you can also use libtooling to build the est, so it's not dependent on how the est gets
created, but it's just a high-level abstract representation of a program, and then I have
some utility functions.
So I did that, and then for my meeting C++ talk,
this last year, so the last meeting C++,
I talked about attributes,
because I realized that with this parsing library,
I can simply extract attributes,
and since C++ 17, if the compiler doesn't know an attribute,
it is required to ignore the attribute.
So you can basically define your own attributes simply by using them.
And then you can use, for example, a CPP AST-based tool to parse those attributes.
And I talked about how you can do reflection and things like that,
and I believe Manu at the moment
is working on it heavily using CPP AST
and doing reflection stuff,
so it's a useful library.
I saw recently a tweet from Manu Sanchez
you were referring to
about how highly he regards your library.
Yeah.
Because if you do advanced libclang stuff,
you quickly find out that it's not really that great.
And it's a reason they recommend that you should use lib tooling.
And I should have used lib tooling,
but instead I fixed it.
So I have this fixed anyway, so I just extracted it
so others can fixed it. I have this fixed anyway, so I just extracted it so others can use it.
So if I wanted to use CBP AST in a project tomorrow, what would I need to do?
How hard is it to build with all the dependencies for LLVM or whatever?
Yeah, well, you need LLVM, and otherwise there's just some header-only or two-file libraries.
It gets, CMake does it automatically.
So it should work out of the box
if you have LLVM installed on a Linux machine.
On Windows, it's installed in a weird way.
But it can work?
It can work.
I have it working on a player.
I never was able to build it locally on my Windows.
Okay, very good.
Did we talk about your compatibility library yet i see that listed on
your project oh yeah yeah this was this was an old library i haven't done anything with it for a
couple a few years actually oh okay it's was it was um it was basically i wasn't aware of the
sd14 feature macros at the time. So it was basically a CMake library
that tries to compile some program using NoExcept, for example.
And based on the fact whether or not compiled,
it uses whether your compiler supports NoExcept,
and then it defines the appropriate feature macro for you.
So you can do, I use it in memory
to check, like, does this compiler support constexpr
at the CMake level.
Oh, okay.
The other big library
I did, I think,
after I was here, was Typesave.
It started, I think, out of a blog
post on error handling.
I wrote a couple of blog
posts about error handling,
and in the last one I talked about how you can use
optional return types to prevent precondition errors
and things like that.
And out of that, TypeSafe was born.
This library provides a couple of utilities
for what I call type-safe programming.
So you have integers that don't do dangerous implicit conversions,
or you have strong integers that don't do dangerous implicit conversions or you have like strong type devs implementation which is the thing i most regularly use out of type safe
this is a really great way to do strong type devs it's similar to
jonathan from fluency pills plus he does also some stuff on strong types.
It's similar to that, but implemented in a slightly different manner
and have things like that.
And they're also my optional and variant implementation.
It sort of became my go-to library for,
I want to have this utility thing,
but I don't want to start a new library,
so I just throw it in there and tell it Swift type safety.
I'm curious, you mentioned a moment ago that
as of C++17,
the compiler is required
to ignore any attributes that it doesn't know.
So,
we as programmers can just, like,
put stuff in attribute blocks, just
for the fun of it. Yes, yes.
I gave a Meeting C++ talk
fun with user-defined attributes, where
they did exactly that. It's not online yet.
Okay.
So I want to dig into that just a little bit.
What does that mean?
I mean, doesn't the standard reserve the right to use attribute names in the future?
I don't know whether it actually does, but the attribute syntax is surprisingly powerful, for example, you have namespaces. And I don't think the standard will ever add an attribute with a namespace,
so you can simply invent your own namespace and use it.
So it's not really namespaces,
you just write name, colon, colon, other name.
So that's the attribute name.
And you can also have arguments to an attribute.
So you can, for example,
deprecated gets a message.
The deprecated attribute gets a message.
But the argument is actually just
an arbitrary sequence of tokens.
So you can put anything in there.
It's a really powerful tool.
Sounds abusable.
It's really abusable.
Yes, yes, I heard.
Yeah.
I'm also curious about some of the...
Going back to your university experience,
you said that it sounds like everything that you've done
that's low-level has been in C at university.
Yes.
Now, I was asking what microcontroller you're programming on
because I was curious if it had a clang target.
If you had wanted to, could you
have used C++?
I'm pretty sure we used
GCC, so we probably
could have used C++.
Okay, yeah, if it's a GCC target, then you
almost certainly could have.
But you weren't allowed to for the
projects? We had to use C.
Yeah, we had to use C.
They even provided a couple of code templates we had to use, so We had to use C. Yeah, we had to use C. They even provided
a couple of code templates we had
to use.
I don't know which C standard we used.
They were kind of
inconsistent with their own code.
So the templates didn't use the
slash slash comments,
but they declared variables in the middle
of a function.
I'm not really sure which C standard they are going with.
Yeah, that's a good question.
It's a shame that they didn't actually provide you templates
instead of just code templates.
No, they provided code templates.
I did a lot of fun with macro meta-programming for register stuff
because, well, I'm a C++ programmer, I guess.
Do you have any idea why they
are having you use C and
not allowing C++?
I think the professor that
organizes it doesn't like C++.
She doesn't like it. Okay.
Do you know
moving forward as
you get higher levels
in your curriculum,
are you able to choose what language you use to implement your projects?
I think it depends.
There are definitely some, for example, graphics courses
where we have to use C++.
And you can also, I'm not sure whether we have to do a project,
but I'm not sure whether or not they require a given programming language for that.
Sounds like there could be a market there for you to do C++ tutoring once it gets to that point.
Yeah, I've done enough C tutoring.
And basically, my C tutoring starts with, well, if C++, you wouldn't have this problem.
Instead, you would have
three others.
Well, you know.
Okay. Is there anything
else you want to share, like recent blog
posts, upcoming talks,
that we've already gone over?
Yeah, well,
I have the talk coming up at
ACCU and hopefully C++ now.
I might even go to CppCon this year.
Depends how the exams work out.
And, yeah, what other blog posts?
If I knew last week that I was going to CppCast,
I would have written a different blog post than the one I wrote.
So we could have talked about that.
I don't even know what the last one was.
Oh, I started at Patreon.
Oh, right.
In December, it's been great so far.
I have like nine people supporting me or so, which is great.
That's pretty cool.
To support you with writing blog posts
and your open source projects, basically.
Yeah, I've made a Patreon organized in a different way.
If you pay more money,
you can select which projects you want to support.
And when I want to have spare time,
I'll kind of look at that list
and pick which project I use based on the data there.
So it's like voting what projects you work on.
Yeah, it's like voting, but you have to give me at least $4 for that.
Voting with your wallet.
Yeah.
Okay, I was going...
Oh, go ahead, Jason.
You mentioned that you might go to CBPCon if you can because of your university schedule and i was i
was actually wondering about that how much this traveling has affected your university classes
yeah for example uh for cpp now i was gone an entire week and i was during the middle of school
it was during the middle of school yes yes it was not a big problem per se the some lectures
are recorded uh for others it's not a problem because they se some lectures are recorded
for others it's not a problem
because they have an extensive script
or something
the only issue was
we had this one professor
in the exercises
he required us to do them in pairs
and every partner had to write
an equal amount
so I spent
so I had to do an equal amount. So I spent...
So I had to do the exercise before CPP now
immediately in a couple of hours
and submit it,
which was a little bit stressful.
But otherwise, it's not a big deal
as long as I don't miss every week,
but they're not...
Sure.
Okay.
Okay.
Well, it's been great having you on again today jonathan
yeah thank you yeah thanks for joining us 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, 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.