CppCast - Virtual Teaching and Plenary
Episode Date: December 10, 2020Rob and Jason are joined by Patrice Roy. They first talk discuss JeanHeyd Meneide's blog post regarding ABI breakage in C and C++. Then they talk to Patrice Roy about his experience teaching C++ durin...g the COVID pandemic, the first ISO Virtual Plenary and more. Transcript CppCast 277: Virtual Teaching and Plenary from PVS Studio News A Special Kind of Hell - intmax_t in C and C++ Lexy Clion 2020.3 Released Links Some Things C++ Does Right - Patrice Roy - CppCon 2020 Sponsors PVS-Studio. Write #cppcast in the message field on the download page and get one month license PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents Why it is important to apply static analysis for open libraries that you add to your project
Transcript
Discussion (0)
Episode 277 of CppCast with guest Patrice Rowe, recorded December 8th, 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 a blog post on ABI breakage and Sea Lion's latest update.
Then we talk to Patrice Rowe.
Patrice talks to us about teaching C++ during COVID C++ developers.
I'm your host, Rob Irving. Joining me is my co-host, Jason Turner.
Jason, how are you doing today?
I'm all right, Rob. How are you doing?
Doing okay. I have some issues with our cats.
They're both at the vet right now because they've been eating parts of our tree,
our Christmas tree, which is unfortunate.
Yeah, hopefully they'll both be okay, though.
Any news with you?
Nothing nearly that exciting, no.
Just finally at a quiet point of year. So hoping to relax.
Well, not relax.
I'll still be working, but, you know,
maybe not feel rushed for the end of the year.
Okay.
Well, at the top of every episode, I'd like to hear a piece of feedback.
Last week we had Robert Leahy on the show,
and we're talking all about networking TS,
so we got a couple comments on Reddit.
This one was from Zaxxon, uh he's saying i wish the people's
language would focus on things that cannot be done based on the limitations of the languages
instead of looking at things which have perfectly good implementations on all necessary platforms
like graphics networking um but he's saying you know something like static reflection is not true
language features that enable new constructs should be what is added to the language everything else
can go into boost or some other boost like library and while there may be different
people focusing on different parts of language i can't imagine that there's not some overlap
and stress coming from core language people thinking about feature additions uh you know
and we can talk to our guest at a moment about his thoughts on this but there are completely
separate working groups working on library versus
core language features.
I don't think this is a
huge concern. I think they can walk and chew
gum and do both library editions
and core language editions.
There are friction
points always. There are
different wording considerations
always. It's always somebody
else's fault, and everyone wants to do good.
What can I say?
It has nothing to do with people being nice or not nice.
There's like clashing concerns.
It's bound to happen.
And sometimes you want core to do something for you that they won't do.
And sometimes you hope that library will fix a trait or something and they
won't do it.
Sometimes the same words mean something different in both places.
It's a big standard.
Do you have any particular thoughts or comments
on something like networking being standardized, though, Patrice?
I've been on CBP chat in a debate on that topic two years,
oh, a few years ago.
It was more than three years ago.
My point is always the same.
I want standardized networking
because I'm so tired of using the C API
and doing interpret tests
and fiddling.
But I understand the points
with respect to those who think it's too big
or that we'll mess it up
because it's complex.
I'd go for the simple API
that covers the basics, really.
And I know there's a push
for security
layer to the
API to be added.
There's conflicts with respect to that. But if I had
at least the basics, that would
let me move away from the
platform headers, I'd be so happy.
How many times have I
written it? I don't know you, but I've
rewritten that API like
20 times in my life already, so I'm a bit
tired. I'm hoping for a standardized one.
I've done, I've used either
some libcurl wrapper or
Qt
or Boost.azio
since
probably, say, 2005.
It was only before that that I would bother going down to the C APIs,
and after that I used whatever library had already been pulled into the system.
But see, the trap there is when you're teaching,
you cannot install APIs.
You don't have the time to do that.
The students, they don't have the time to do that.
So you need to go with what's already there.
So when you're stuck there,
you're using the Unix or the Windows platform API to work.
Unless you can include something that's standard C++,
and then you're done.
But I cannot make students install boosts.
I don't have the time to do that.
But it gives me an excuse to show unions
and talk about interpret, cast, and alignment.
All of this is undefined behavior.
Don't worry about it.
So hi there. And I have a cat that bites its tail
all the time and it has this cone around
its head right now because it's damaging itself
so cat
okay
well quickly 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 cpcast.com and don't forget to
leave us a review on iTunes or subscribe on YouTube.
And joining us today is Patrice Rowe.
Patrice has been playing with C++ either professionally for pleasure or for work for over 30 years.
After a few years of doing R&D and working on military flight simulators, he moved on
to academics and has been teaching computer sciences since 1998.
Since 2005, he's been involved more specifically in helping graduate students and professionals from the fields of
real-time systems and game programming develop the skills they need to face today's challenges.
The rapid evolution of C++ in recent years has made his job even more enjoyable. He's been a
participating member in the ISO committee since late 2014 and has been involved with the ISO
programming language vulnerabilities since 2015. He has five kids, and his wife ensures their house is home to a continuously changing number of cats, dogs, and other animals.
Patrice, welcome back.
Hello. The number of cats is seven right now. It's a small number.
That's what I was going to ask, is what are your current numbers here?
Seven cats, any dogs at the moment?
Yeah, two dogs, three birds, and a hamster in the youngest one's bedroom.
Oh, dang. There's got to be a partster in the youngest one's bedroom. Oh, dang.
There's got to be a partridge in a pear tree somewhere at that point, I think.
We have parrots.
We have two small parrots and a big one, but the big one, it's like a raptor.
You know in Jurassic Park?
Oh, yes.
It attacks you.
It's a very dangerous bird.
It's very sweet with those that know it, but it can remove your fingers very quickly.
So are you one of the ones that it likes or not?
Depends on the day.
I tried
to give it water this morning and it attacked me
so it has no water right now and my wife
will fix that.
I guess I don't blame you.
My wife's good at this.
Okay, well Patrice, we got a couple news articles to discuss.
Feel free to comment on any of these and we'll start talking more about what you've been up to lately.
Okay.
Okay.
So this first article is on Jean-Huidh Manid's blog.
And this is a special kind of hell, Intmax T and C and C++. And we've talked about ABI breakages
fairly often over the past year or two.
But this goes into the ABI breakage situation in C,
which is apparently much, much worse than C++.
And C++, yeah, both.
It's a very bad article.
It's very clear, I think.
Janit did a good job with this.
It's a serious problem.
It's hard to fix.
According to Janit, it's unfixable in C,
and that might just be the case with the principles that they have.
It is very tough to fix in C++.
What I liked is that he pointed out that we have the same problem,
in a sense, with size T and other such types.
The aliases that we have are good,
but they do bring problems in some cases.
And Fortran might have had the good idea
to encode the sizes of the integers
in the names of the types in some cases.
Yeah, it's not a bad idea, but yeah, that's what we have.
So I recommend that article.
Great work, well-written, very clear.
I feel like there's at least a tiny bit
of hope since in C++,
at least in the APIs that we define,
I mean, that are part of the C++
standard library, not part of the C standard library,
we can use overloads
and then that's encoded
into the name mangling where
I never even considered this before. The fact that
C doesn't have any name mangling is just
amplifies this problem.
Well, you have macros, as you said.
Nice and handy.
I'm a fan of exposing your internal names as types in your classes,
like size type and value type.
I'm okay with that because it lets client code evolve properly.
But indeed, the way that
these things like IntMaxT
are used and defined,
they bring a special kind of health
to us. Yeah, he wrote the right thing.
I will just say
also for the record, I didn't even realize
IntMaxT was a thing.
I thought that I knew all the standard
types or type defs.
It's one of the things that make people tremble when you go to standards meeting.
Nobody wants to touch that.
It's volatile.
There's a few others like that that are just scary.
Is there also an int min T for a car type def, basically?
Nope.
No, because you cannot go lower than a byte.
It's the upper bound that's a problem.
Okay.
All right.
Next thing we have here is a library.
This is a new one from Jonathan Mueller,
and it is called Lexi,
a parser combinator library for C++17.
And I didn't look too much into this,
but it looks like it's pretty powerful C++ 17. And I didn't look too much into this,
but it looks like it's pretty powerful with being able to specify a new DSL.
I didn't play with it
because I just looked at it this morning,
but really I like the technique,
the approach.
I'm looking forward to...
Sometimes you look at something
and it's the idea that's important.
When I looked at Atomic the first time, I liked the syntax. I liked the way it expressed the idea that's important when i looked at atomic the first
time i like the syntax i like the way it expressed the idea that's pretty pretty powerful way of
naming things so when i looked at the yoratan's library this morning quickly i like the idea the
approach there's something inspiring there so thank you for that it's pretty cool i haven't
played with it though so i don't know how good it is in practice. But it's inspiring work.
For our listeners, if you want to get an idea for something that's pretty relatively complex,
he has an example JSON parser that is in the examples
folder. And if you remove the test code, it's only
272 lines, which is a pretty
succinct JSON parser.
Mind you, I've seen one by Louis Dion at a meeting once that was scary small.
Some people are very creative with JSON parsers.
Well, I mean, I've also seen small ones, but to be fair, the small ones that I've seen weren't necessarily tested for compliance.
And this one actually does claim to be at least
fully compliant. So I don't know about Louise,
of course, but yeah.
The separation
between the rules thing and the
way the values are being defined,
there's really something cool.
I urge readers or listeners to
take a look at it, if only for the form
it takes, because it might give them
ideas for their own APIs.
Okay, and then
the last thing we have is
from JetBrains' blog, and this is
CLion 2020.3,
which is going to be their
last release of CLion
for this year, and
a lot of new features that they're advertising
in this blog post, core dump
debugging, C test support, MISRA guideline integration.
So it looks like they put a lot in here for this final release.
Jason, are you still using CLion as your IDE?
I am.
You know, it really actually is saving me a ton of time when it comes to working on large client projects.
Because being able to quickly navigate around the code and stuff is just and you know
if you know anything about me like a year ago i wouldn't have said that at all i'm like them who
needs an ide but uh yeah anyhow uh and it's funny because i actually upgraded to 2020.3
before i started the current um task that i'm working on and didn't even realize that i was
now able to drag the little arrow around inside the debugger and just do, you know, moving forward and backward inside the debugging.
Yeah, that's nice. I know that feature has been there in Visual Studio for a while,
but it's nice to see it in the CLion ID as well now.
Yeah, I haven't played with it much myself. I played with it on the surface a few years back,
but I like the efforts that they're doing.
I hear a lot of people complaining about the debugging experience of their tools.
So maybe the better debugging experience helps everyone.
And the way that the MISRA rules are being shown,
or I wouldn't say enforced in there, but recommended or suggested,
whether you adhere to these rules or not is interesting. It's a nice way to present things.
Yeah.
And if you're interested in learning more about what's new in
CLion 2020.3, it looks like there's a whole bunch of videos
from our friend of the show, Phil Nash. Looks like he's showing off
a lot of these new features in little videos. And he makes cool videos too,
so you can just watch them for the fun of it.
Okay, so Patrice, So you can just watch them for the fun of it. Okay.
So Patrice, it's been a while since we had you on.
I think one of the first things I wanted to ask about was the recent virtual plenary,
which I think you attended and asked how things went at the virtual ISO plenary.
It was actually quite interesting.
I don't think anyone
knew how long or how short
it would be. We had planned a few
hours and it took much
less than what we had planned.
There was almost nothing controversial.
Normally there are things
that people care
about a lot in plenary and
call votes on and there's a lot of discussions.
In this case, the only one was the suffix for size T.
That kind of, well, they were against, but
there were some votes against, but it was a majority vote. And most
of the stuff really passed without problem. There wasn't anything really controversial.
The big thing was discussing how
code of conduct is enforced
and how we can make the community more inclusive,
how we deal with each other, with all the online meetings all the time.
Because it's harder to make humor, snickering remarks.
And it's harder to pass emotion through writing when you're doing technical stuff.
And it's easier to get affected by what other people write.
And if we want to make the community more inclusive,
it's something we have to care about.
So there was a presentation on that, discussions.
Enforcing the code of conduct can be seen as something oppressive by some, too.
So the way we do things is important.
We had a poll before the meeting.
We discussed the results together, the interpretation of the results also.
So it's important, you know, human beings caring for each other, making sure that everyone can express themselves, get heard, what we can and cannot write in public.
So it was an interesting meeting on the human side of things, because the technical side,
there was nothing really controversial there.
I close, though, to Davis Herring, who wrote a huge paper in CORE that expressed much more
clearly how a number of things are being done, particularly, if I remember, the overload
resolution rules, which are very complex.
So Davis did a tremendous piece of work.
And normally there's one of these plenaries
at the end of each standards, in-person standards meeting, right?
Yeah, there's one at the beginning
where we normally put the rules for the week.
But the WIP plenaries work.
So you get there at first, everyone's in the same room normally.
We were between 100 and 200 in the virtual plenary,
which is a big number, really.
It was fun to see the faces
of people and everything.
So, yeah, there's one
at the beginning of meetings
where we set the rules for the week,
discuss room assignment,
remind people of the code of conduct.
There's a number of administrative steps
that we have to take,
the things that we have to vote
to start the ball rolling.
And then we plan the evening sessions
because we normally have evening sessions on top of the day sessions.
There's a very strict adherence to timing
to make sure that everyone can eat and drink and sleep.
But there's evening sessions almost every evening.
And then we meet at the end for a plenary on Friday afternoon.
We take votes.
And then there's an administrative plenary on Saturday morning,
normally where we close some issues with some isolated votes that we have to take.
But there's essentially two big meetings, one at the beginning and one at the end.
So this one was kind of an end-of-the-week meeting where we took votes based this time on the work that had been done in the various telecons that we're having because there's telecons every day.
It's very hard to follow the heart.
There's so much work being done right now.
So is this the first closing plenary that you've had this year with all of the cancellation of the in-person meetings?
Yeah.
Well, no, there was Prague.
Prague.
But I couldn't go there for base money issues because it costs a lot to move around.
Prague isn't a costly city at all.
It was a beautiful thing, but you have to finance the trip um so and the other ones had been uh
had been canceled indeed or or moved to the future let's say so uh we had one in bulgaria
if i remember and one in new york that were planned that will be done at a later time
uh so yeah but there were a lot of virtual meetings you're both smiling but i say a lot i mean a lot i mean yeah you should see my email box it's crazy
that if i did every one of them i would be in a meeting every day but i'm already in a meeting
every day at work so and that's one of the things we discussed there's meeting fatigue in people
people have day jobs it's's volunteer work, the committee.
So at some point, there's just too many meetings.
We have to find a way to get around that.
On the other hand, it makes the language evolve in advance,
and people do get work done.
So you just need to find the right equilibrium there.
I fortunately do not end up in very many meetings
due to the nature of my work, which I'm actually really thankful for.
But I have heard that from a lot of people about meeting fatigue, Zoom fatigue and stuff.
And in fact, it's interesting.
Excuse me.
It's interesting because with my meetup, I have had a lot of my normal regulars stop coming to my meetup because it's virtual and they're like, oh, you know, I'm too busy or too tired of being on Zoom all day to come to another Zoom thing once a month.
And I totally appreciate that.
I'm not going to give them a hard time.
But I've had an entirely different group of people who are from all around the country and in some cases around the world coming to my meetup, who don't seem to be suffering or, you know,
whatever their tolerance level is for these things.
They're taking advantage of the situation.
Probably depends on what they do during the day.
I mean, if you can do normal coding, that's cool.
I give classes, so I'm always on Zoom these days, really.
I'm on Zoom maybe 7 to 12 hours per day.
Oh, wow.
It's really significant.
The students that I have are tired.
So they're isolated.
Even when they're living with their families, they're isolated.
They don't get to see other people much.
They're always in their bedroom or something.
So they're starting to suffer from depression, anxiety.
Anxiety was more at the beginning, depression these days.
Some of them are confiding to tell me that they're having hygiene issues.
They don't wash anymore.
They're having sleep hygiene issues.
They don't sleep much.
They have trouble getting up in the morning because it's too hard.
There's no routine left.
So I'm trying to make them work as a team, talk to people and everything.
So Zoom fatigue is not Zoom.
It's isolation.
It's the fact that you're not really talking to people anymore.
And I think we can see now that we need to relate to people.
Wow.
So, I mean, since you brought it back around to school,
how many classes are you teaching right now?
No, no, I was hoping that we would talk about that. How many classes are you teaching right now no no i was hoping that we would talk about that how many classes are you teaching at the moment uh two two at the
university and i have three groups in college two of them being uh of the same uh same class and the
other one something else so um the third semester fifth students, and then master degree students.
One video game programming class.
This is actually fun, you'll like that.
That video game class,
most of them come from France these days.
I got a lot of French students.
They're very cool, very brilliant and stuff.
And normally they come to Quebec with me to study because in Montreal,
there's this big game development community.
There's a lot of work and a lot of jobs.
And so they want the vibe, but they can't
come from the vibe because they can't cross the border
these days. See, we're going to
have them in the winter. There's mechanics
involved, but we'll get them. They have
quarantine and stuff, and they'll all arrive
in early January.
But right now, they're all in France. So I'm giving
classes on Friday morning
at French time.
For me, it's 7 in the morning.
But I have a few French
Quebec students. I had two at the beginning.
One right now because one of them had to move around.
So for some of them, it's very early.
For the others, it's in the afternoon.
So they have to...
But I've never seen them in real life.
I've been with them every week, but I know
what some of them look like, and that's about it.
Most of my students in general, I don't even know what their face is because they are not forced to open their cameras.
So I know they're not.
But it's a very strange experience.
So I'm trying to make it engaging and fun and make jokes, trying to put some more time aside to speak to people and discuss their work and see what's going on in their screens or
sharing, co-hosting with them so that they can show me what they do. So giving them some personal
time more than giving actual formal classes, if I can, because it's more human that way.
It's less referral for them. So I just have a hard time accepting that you've been teaching
a class a whole semester and not even know what someone's face looks like.
I think at some point I would just crack if I were you as the instructor.
Turn on your camera!
No, we can't force that because you have the right to control your own image.
I'm trying to get them to do that for the exam.
I'm trying to make it fun.
Let's make it cool, everyone. Just at least for one session, for
one period that I can see
your faces and know who I'm leaning with.
And I can supervise better what
they're doing if I do that too.
But I cannot force them. I know
professors don't want to show their faces because
they want to control their public image too.
But that's pretty weird because
it's difficult to get human
contact if you don't see the person you're dealing with.
Some courses are purely asynchronous, not mine.
I give synchronous content all the time.
But some professors, they write small YouTube-style capsules like what you do with C++ Weekly or something.
And they publish them.
But you can learn through that, and that's fair.
But it's a different way of teaching.
And if you get only that in a semester, you no contact with anyone so you're completely isolated so i'm just
hoping that those who do that the students see other teachers at least or other professors and
can actually speak with them sometimes so are these classes just like normal university classes
you meet for an hour hour and a half three days a week or something like that three hours in a row
though we were together for three hours in a row and
we actually do work.
They see my screen,
I write code with them, we discuss things.
I do the same thing I do normally, but
normally I'm in the room with them, so
I speak loud and I
hit on tables.
I cannot
speak loud because they have me in
their ears right now.
I was going to...
I don't want to worry about it.
I used to do that when I gave CVDCon talks,
and I stopped because on YouTube people were complaining,
my ears!
So I don't do that anymore.
I can tell you that when they come to Quebec,
the French students in January,
we are going to put them in a big room, like very tall ballroom style class,
such that we can spread them out and they have a lot of room and we can ventilate the place properly and take care of them.
But yeah, I had one class in person during the semester.
It was a very tiny master's degree class with two students.
It was cool.
So it was in person.
I could actually go there physically and speak two students. It was cool. So it wasn't person. I could actually go there physically and speak.
It was awesome.
And after mid-semester, one of them
hurt his back, so he had trouble walking.
And the other one got COVID.
So he was delivering things for Amazon
during the day, and he got it somewhere.
So we moved to remote
classes for the second part of the semester.
So if I understand right, UK is getting ready to roll out some vaccines next week.
They actually did. Someone got vaccinated yesterday.
Okay. Now, since you're involved in university and college curriculums and stuff,
is there a discussion about what that looks like from the university perspective?
Does anyone have a plan saying, okay, if we start getting vaccines rolled out,
then we will do X?
Well, we don't decide.
In Quebec, at least, it's a governmental matter,
so the government gives the rules.
This fall, at Sherbrooke University,
where I give my classes,
they had rented office space outside of the university
to get more room and spread people more, so they had rented churches. Some of the university to get more room and spread people more.
So they had rented churches.
Some of the classes were given in churches because there's space there.
You're right.
And they could maintain the actual in-presence experience for, I'd say, two-thirds of the semester.
They had to stop at some point because there was an outbreak in the area there.
And my understanding is that the exams are being done in person too right now. So
they moved back there, even though they couldn't go there, but they're there now for exams currently.
In college, what we maintained was the classes that require presence. So when you need nuclear
devices or things that could explode in your house, or when you're putting needles in the
arms of animals or people.
So these things are done in person in smaller groups,
and the other things are done remotely.
So as you can imagine, my classes are all remotely
because I don't put needles in anyone.
You could still ship nuclear reactors to your students, though.
I could totally do that, I guess, but I don't.
But we do have classes with robots and stuff,
so these will require some in-presence work during the winter.
I find that's a fascinating solution,
because if you know anything about church buildings,
at least ones that I would say are at least 40 years old or more,
they all have a giant open basement structure or something like that they all do and most of them
aren't meeting in person these days regardless of where you are it would it is a giant area where
you could have a few number of people with social guidelines and whatever yeah you have to make sure
they're they're they're far from one another there was a a wedding yesterday in quebec with
a specific religious community where there were 200 people in the same room.
So the police had to go there and close the place.
They don't want the wedding to happen, of course, but because you cannot have right now 200 people in the same enclosed space.
Right.
Yeah.
It's tricky.
So at university, we tend to have smaller groups.
I can tell you that there's basic hygiene stuff. Like you go to the bathroom, well, there's one urinal every two that's closed
and one sink every two that's closed.
And you have to move around with a mask in your face.
When you're sitting down in your office, you can remove it.
So there's a number of rules like that.
Right.
Since you're talking about some of the difficulties with teaching over the past few months,
have there been any positives?
Any things you've found that have been nice with teaching this way?
Well, I use less gas.
I'm quite late on my podcasts.
Normally, I'm pretty much up to date with CppCast, among others, and now
at least five podcasts I listen to,
I'm like 20
episodes late or something.
What's nice? The tools
are holding up. That's my
biggest... Surprise
might not be the right word,
but it's cool that
Zoom teams and stuff, they've all
held up. There have been almost no failures in the last nine months or so for me.
It's held up all the time.
There's previous power failures and stuff,
but most of the time it just works fine.
Sharing documents has proven to be functional.
Seeing students' screen works.
Those who are mature enough, they ask questions.
That works too.
The Discord rooms work.
People, they trade ideas and stuff and they help each other.
So, yeah, we can make it work.
It's not pleasant, but it works.
I'm happy about that.
The worst part is grading.
So reading the assignments that they do, the papers, grading, that takes forever.
That takes forever because, what I mean forever, I mean like five times as much time as it normally does.
And why is that?
It's because you don't see them.
So you cannot present something, just circle something in red and say, come speak with me and be face-to-face and explain things.
You have to put things in a, so you have to bring context,
and you have to be careful because they're depressed on the other end.
You don't see them.
You don't know in what state they are,
so you have to make sure that they will get the gist in a constructive manner.
That really takes a lot of time.
When you have a 54-person class, it takes weeks and weeks and weeks on end just to grade one assignment, so I'm so
late in my grading.
Wow. Do you use
at all any of these automated grading
systems where the student uploads
the program, and if it gets the correct output,
then they pass or fail, that kind of thing?
No, I'm against that.
It's fine for one part of the job,
but it doesn't tell you if you wrote
actually good code.
Right.
So I have to treat the thing.
What I will do, I will try to do self-correcting exams for the execution part of things.
So I'll make sure that if I can, I'll make sure that part of the work, like the execution part, I can auto-grade or something.
But I'll still look at the code, and that takes forever. Yeah, it was like my, I don't know, second or third year in university
when they started using automatic grading for the earlier classes,
so I exactly missed that phase at my university.
And when I saw that they were doing this, I was like,
how does that work at all?
Like, as a student, it would feel completely demoralizing if it was pass or fail
simply on whether or not it produced the right output.
Because you could just write a program that did everything wrong or cheated
depending on the nature of the project.
I think part of my job is giving feedback on the practice of programming.
So I try to see if their code leaks.
I look how they close their files.
I look how they dispose their code,
how they name things.
So it inspired some of my CBP con talks this year,
the code that I saw and made me react.
But I think it's important.
It's okay that you don't do it every time
because at some point it takes too much time.
But you have to do it at least, I think,
at least once per semester
to give them some written feedback
as to how they do things.
But so I self-impose that hell on myself.
I like reading code.
It's just a matter of time, really.
Reading code is important and it's fun.
But when they're beginning,
it's not always pleasant to the eye
see
yeah
I want to wrap the discussion
for just a moment to bring a word from our sponsor
PVS Studio. The company develops
the PVS Studio Static Code Analyzer
designed to detect errors in code
of programs written in C, C++
C Sharp and Java. The tool
is a paid B2B solution but there are various options for its free licensing
for developers of open projects, Microsoft MVPs, students, and others.
The analyzer is actively developing.
New diagnostics appear regularly, along with expanding integration opportunities.
As an example, PVS Studio has recently posted an article on their site covering the analysis
of pull requests in Azure DevOps using self-hosted agents.
Check out the link to the article in the podcast's description.
Well, since you mentioned your CppCon talk,
I think you gave two talks at CppCon 2020 this year?
Yeah, two talks in a class.
Do you want to tell us a little bit about your things
that C++ does right talk?
I do a lot of C Sharp these days
and a lot of JavaScript because
the college where I teach, they use these
tools more in C++
in the current program that they
installed three years ago,
which annoys me a bit because
the students will not learn as
much.
I hope they will continue to go to school
for a little while after that,
just to give a broader perspective on programming,
because managing resources might be something
that they won't be as good at as they should be.
Still, I see a number of things that other languages do,
and I keep seeing people complaining about C++ all the time,
saying, oh, this is so bad, not type-safe, not memory-safe, blah, blah, blah, blah, blah.
Which, of course, there's bad things in every language.
But I do notice things that C++ does really, really good in the way it...
I know initialization is complicated, but there are things that we do right.
And that's what I tried to put there.
If you put a default value in a member variable,
and then your constructor passes and does something else,
there will be only one initialization, not two.
If you do C Sharp, you're going to get two initializations for the same variable if you do that.
There's a number of interesting things that we do that are pretty cool.
The fact that we have value semantics is awesome.
People underestimate the importance of local reasoning and value semantics.
So I tried to put these things, some of these things at least,
because it's not an exhaustive list, it's a huge language,
and there's many languages out there,
but I tried to put a list of these things that I noticed that we do right in that talk. And it's funny because I also had another talk on things that we,
I called that of void parent-parent functions and other innocuous evils.
So I had this dark talk on things that are wrong
and this bright talk saying things that are more right or that we do right.
So I had these black slides
and these white slides or such.
I tried to do something cute with it.
I hope it worked.
It's funny because I gave that
things that C++ does right talk
at the user group in Montreal a few
weeks before. And kind of like you were
saying, Jason, the regulars weren't all
the same, but there were people from Toronto
and Vancouver,
so I could see a number of friends that I see in conferences
and committee meetings there.
And so there was quite a big audience, a lot of discussions afterwards.
People reacted nicely to it.
I was pleasantly surprised.
I'm curious, was that meetup held via Zoom?
Yeah. surprised. I'm curious, was that meetup held via Zoom? Did the attendees
keep their cameras on while you were
talking?
Not all of them. I could see a few.
I could see who the host was.
In some cases, I could only see
the names, of course.
But there was action in the
chat room, so people were expressing
themselves through writing, kind of like what they did in CGPCon.
So it was kind of interactive.
So the usual culprits were quite visible, but there's people that you see and talk more and ask more questions, but that's fine.
And, yeah, again, the tools delivered, and it worked fine.
Right.
I hope people liked it. I noticed some people saw some of my code samples on YouTube after that
and said, well, that's bad C-sharp code.
I know that's the point.
It's not that C-sharp is a bad language.
You can do that with it, and it's kind of weird.
So you have a string S equals null,
and then you add null, and you check its length, and it's zero.
Because if you add null to a null string you get an empty string that's that's weird to me yeah that's
weird but it passes it's fine maybe it is good in some mindset but i i like my strings to be values
so so yeah there are value semantics are awesome like some of those javascript shenanigans where
you can add a i I don't know,
a string and a number in one order and you get a number back.
You add it in a different order, you get a string back and that kind of thing.
But we can craft that in C++ too because we're crafty people.
That's true.
I'm worried about that because at some point I made a joke on that on Twitter
and, Brendan, I don't know if I pronounced his name properly, he went
back to me and said, hey,
it's not getting on set. Okay, I like
JavaScript, don't worry, it was just a joke.
So yeah, I'm sorry.
Any other
specific examples that
you thought were worth mentioning from that talk
about things we do right in C++?
Well, the
right part,
the big point really was
what made me write that talk
was that I realized that we have a language
that lets us be efficient.
We don't have to fight against it to be efficient.
In some other languages,
you have to make effort to be efficient.
The basic code that you will get,
you will be required to write new everywhere.
You will have to handle null values.
Initialization will be considered cheap because you're only using references all the time.
So they will tend to do more work than they should in many cases.
There's things that we can write elegantly in C++ if you understand how containers and iterators work
that are difficult to write in other languages,
but they provide functions that do it for you.
But if you had to do it yourself, you'd be in trouble.
So we have very good groundwork tools
to build nice things from clean abstractions.
If you learn the basics, you can do many things easily.
You don't have to go through an API and look for the function
that has already done it for you.
So that's one of the things that I really like about C++,
the expressiveness of it all.
One of the examples that I had in my talk was a read-all text or something.
In C Sharp, if you want to read all the text from a file,
you need a function that does that for you.
If you have to write it yourself, well, it's involved.
In C++, it's a one-liner
because you can use a pair of iterators on your stream
and build a string from it and you're done.
And it's the same way you can copy containers.
You don't need to have a to array or a tool list to do it for you.
You have constructors that do the job.
It's a very general solution to the problem.
It works. It's efficient. It's clean.
But it's okay also to have a big library with a number of special case tools that work.
That's not bad.
But I appreciate it in C++. That's not the way we went.
I always find myself frustrated
when I'm in JavaScript or Python
or C Sharp or whatever, and you're talking about
value semantics, and I'm like,
is this a copy or a reference? I don't know
what's going on here, because if it's a
struct or if it's a built-in type or if it's
a class, then it changes meaning in different
languages, and the fact that we have this consistency in C++,
I think, is a huge thing for me.
Think about lambda captures.
So when we write lambdas,
we express precisely what we want to capture
and if it's by value or by reference.
If you're writing a lambda in C Sharp, you write less code.
But if you want to do something else,
then a reference to something, you need to use a variable in C sharp, you write less code. But if you want to do something else than a reference to something,
you need to use a variable in the enclosing scope,
make a copy of it, and then use that copy inside your lambda.
Otherwise, you'll be referring to something you might not be looking for.
So if you're doing a for loop that starts threads
and capture the index variable of your for loop,
you're going to be in trouble in your lambda
because you're getting referenced by default.
But if in your for loop
you make a local copy of the thing, then you
capture a local copy and it's a different variable
for every iteration of the loop.
It's not bad, but to me it's weird.
So I kind of appreciate that we can
clearly express our
IDs in C++ and there's no ambiguity
in the code when you look at it.
I just think C++ is perfect at all.
It has lots of words, and that's fine.
All languages do.
But it's reviled by some, and I think it's unfair.
I think it's a beautiful language.
Well, before we were getting ready for the show today,
you mentioned that you were working on a set of requests for SG14,
which is the committee or subgroup working on game development
and high-performance features.
Do you want to tell us a little bit about that?
Absolutely. Low-itency group.
I was approached by one of the big game companies in Montreal in 2019
because they said,
well, it's time that we tell the standards people what we want and what we need.
And I really, really appreciate that of them.
Very cool people.
I want to name them because I want to get more games people involved.
But they came with a list, a written list.
We went to a cafe.
We chatted for about an hour, an hour and a half or something.
And then we did a number of ping pong emails to make
the list more formal, clearer
and then I started going to
other companies and I'm building this
I have
the French name in my mind, I don't have the
English name, sorry, but this list, let's say
formally written
of things that the companies would
appreciate from the
language, some library stuff some core language stuff of things that the companies would appreciate from the language.
Some library stuff, some core language stuff.
I think it's a reasonable list.
There's a number of things in there that will go in the direction that the language is already going.
So I'm trying to prepare the presentation of this thing
in such a way that I will get maximum support from first SG14 and then the rest of the committee.
I think it can be something that will bring people together.
It's a good list.
There's, astonishingly to me, a number of non-performance-related things there,
things about safety, integer overflow, better compiler diagnostics,
because they do a lot of debugging.
Yeah, so I have I'd say around 30
requests right now that we'll try
to categorize and bring to SG14
in order to
make C++ closer
to what the low latency
people need. So I'm hoping to do that
early 2021,
I say, because I have the list.
I just have to put that together in such
a way they can present it.
I met two big companies so far.
We spent
three to four hours
in both cases.
And yeah,
I think it will appeal to a lot
of people. So it's nice to see
niche, big niche,
but niche communities there trying to bring the language better,
but in a way that will benefit everyone.
Is there any standout interesting performance things
or whatever that you would like to call attention to?
Well, the trend towards compile-time programming continues.
Oh, interesting.
Yeah.
There are things that people like in C Sharp
that they would like C++ to do,
like compile-time string formatting.
So it's the format, but constexprized.
I think we can do that, really.
So the string interpolation that C Sharp does,
something like that, it would, I think, benefit lots of people
if we could find a way to make it work in C++, and we probably can.
So I can tell you about that.
They get bitten by a number of math-related problems.
So they're looking for better overflow diagnostics
or UB detection behavior.
So they like that a lot.
In terms of performance,
I should have brought the list with me. I could have
given you a more complete list, but let's say that
since I don't want to
commit myself in public right now
before I say this, I won't go into details.
And that will hide the fact that I'm not ready
for this.
I'm curious, since you
mentioned signed integer
overflow a couple of times, or integer overflow a couple of times, I'm curious, since you mentioned signed integer overflow a couple of times, or integer overflow a couple of times, I'm curious if they ever, or if they have the capability of testing their games with UBSAN enabled to see where it catches these things, if that's interesting to game developers?
Yeah, they could. But what I heard was unsigned. Some of them would like unsigned integer overflow to be considered UB with some compiler options
in order to detect it better with such tools.
Some of them would like when, in some cases, they would like that to be considered as UB to detect it more easily.
So that surprised me, but I heard it from two different companies.
So there has to be a need for that somewhere.
I have used cases that they suggested.
Just reminds me of watching your score counter flip over in an old game kind of thing.
It still happens.
It still happens.
But these are real needs that come.
As I said, it's about 30.
It's real needs from the ground.
People who live with C++ day to day do things that are interesting with it and say, well, the language could be better for us if you had this, this, this.
Of course, there's always the exception related things because they don't like exceptions.
But they would probably like the Herbceptions and they would like us to push for them or something similar.
So that's clearly one of the things that they target, but it's a long list.
Okay.
Look forward to that early 2021 when I get the chance to write it.
If they solve all of these problems and get the safety that they want, there's going to
be an entire category of Twitch speedrunners who will be out of a job.
I'm sure
they'll find something else to do.
Yeah.
Those are fun to watch.
Is there anything else you wanted to go over
today, Patrice, before we let you go?
I don't know.
What can I say?
I miss listening to CBG guests. I miss meeting the committee people.
I can tell you that one of the highlights of the last meeting to me was that Mr. Brown, Walter Brown, told us he would be retiring.
So let me mention that I have huge respect for the man. He's courteous. He's very nice, he's a bright mind, very focused.
His CppCon talk this year, to me, was the best one we had.
I haven't seen it on YouTube yet.
It was a tremendous piece of work.
It was tied to how we find names through ADL and other mechanisms.
It was really awesome.
And in the same area, let me say that I miss Mr. Dawes,
who just died last week, a lot too.
He's someone I met at CVPCon.
I had the pleasure of working with him in a few meetings.
He was retired for the last two years or so,
and we will miss him. He had a keen mind.
He was gracious to me, and I
appreciate him very much. So we're
lucky. We're working
in a science that still has
some of its giants, and
we're lucky to meet them,
and we're lucky to have the chance
to benefit from their knowledge and
skills. And when they
go, Mr. Brown is still very much alive, and I hope he will remain alive for a long skills. And when they go, William Brown is still very much alive,
and I hope he will remain alive for a long time.
But when they go,
well, a part of us goes too.
Okay.
Well, it was great having you on the show again today, Patrice.
Thanks for coming.
You're very nice.
Thank you.
It's always a pleasure, friends.
Thanks for coming.
Bye.
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 cpp cast and of course you can find all that info and the show notes on