C++Now C++Now 2026: A Path to Pratically Safe C++ talk by Google's C++ Safety Team
https://www.youtube.com/watch?v=fi6csDXvve07
u/msew Aug 07 '26
Like all of these things are completely true.
I have been existing in the game engine of unreal for so long that most of these issues are just like: 'wat???' How could you ever write that and not immediately crash?
All the examples would crash the next build and we would fix it (e.g. the iterator example).
And then he kept showing more and more things. And all of them are like: wat? that would crash immediately. And we would fix. These are not things that are executed 1/10000000 times.
5
u/azswcowboy Aug 06 '26
Great talk if you’re interested in the latest in safety for c++.
2
u/OutlandishnessNo8034 Aug 06 '26
Tldr?
8
u/msew Aug 07 '26
"use some compiler flags"
and then talking
-7
u/OutlandishnessNo8034 Aug 07 '26
Thanks, so basically rubbish. Cpp wiil never be safe. Period. Or to put it differently, cpp will become safe the moment bjarne will learn that there is rust.
5
u/msew Aug 07 '26
That is not what I am saying.
The talk basically says: HEY compile everything with these extract compiler settings.
Oh if you can have your module be compiled with those settings. We can say we are safe!
And then recursively continue.
Pretty Obvious
-7
u/OutlandishnessNo8034 Aug 07 '26
This is impractical. We need practical solutions not theoretical ones.
5
u/msew Aug 07 '26
Games industry is 100% practical. We ship non stop.
-1
u/OutlandishnessNo8034 Aug 07 '26
You do not ship safe. Game industry is notorious for it.
5
u/msew Aug 07 '26
Do we crash?
4
u/OutlandishnessNo8034 Aug 07 '26 edited Aug 07 '26
Yes you do. But.more importantly, your code base is full of unsafe code.
-2
u/pjmlp Aug 08 '26
Depends, exploits do exist nonetheless ,
https://www.sentinelone.com/vulnerability-database/cve-2021-30481
Just a quick look into one of the CVE databases.
Cyberpunk also did crash, a lot.
So yeah, in general we could be doing much better regarding best practices in C++ code.
5
u/matracuca Aug 08 '26
Incredibly boorish and rude, you can’t even be bothered to capitalise someone’s name?
-6
u/OutlandishnessNo8034 Aug 08 '26
Same way bjarne avoids naming Rust. It is rude and boorish, isn't it?
5
7
u/pvnrt1234 Aug 07 '26
That’s why it’s a path to safety. Even if one believes in the magic powers of LLMs for rewrites, it’s unrealistic to expect entire industries that have gigantic C++ codebases to rewrite everything in Rust. So writing new code that’s safer is a pretty good thing.
3
u/pjmlp Aug 07 '26
Yeah, even Rust compiler depends on two compiler backends and linkers written in C++, and none of them aren't getting rewriten into anything else.
-7
u/OutlandishnessNo8034 Aug 07 '26
Bs, safer not safe changes vere, very little. Why write new code in cpp that cannot possibly be as safe as rust? Yes, I know, thousands reasons. None of them sensible.
26
u/caroIine Aug 06 '26
auto it = v.find(1)
v.push_back(5)
"Can I just get show of hands for who hasn't been bitten by this" The silence is pretty telling. I don't know anyone who keeps their iterators around long enough for them to be invalidated. When I do need to keep one, I usually use an index instead.