Closing the Gap between Rust and C++ Using Principles of Static Analysis - Sunny Chatterjee - CppCon

preview_player
Показать описание
---
Did you know that 70% of serious security bugs are a result of memory safety issues? As a C++ developer, you may have heard about the safety benefits of Rust language. Although both Rust and C++ are high-performing system programming languages, we are increasingly hearing from customers and security researchers to have stronger safety and correctness guarantees in C++. Safety and correctness are no longer viewed as an opt-in behavior. The new adage is – if it compiles, it works. Static analysis has proved to be a valuable tool in empowering developers write modern C++. In this talk, I will share some ideas on how we can use the same principles in modern C++ code to provide strong statically-checked guarantees out-of-the-box. I will demonstrate some of these techniques live using MSVC’s code analysis tool.

---
Sunny leads a team responsible for developing the core C++ static analysis engines in Visual Studio productivity experience as well as the traditional security tooling scenarios used widely within Microsoft. He has many years of experience in static analysis and enjoys delivering new productivity benefits to customers. His current focus is to lead efforts towards making C++ a safer systems programming language.
---

*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

22:13 Should trigger another static analysis warning since modifying a temporary with no side effect doesn't make sense and an optimising compiler is free to remove that code entirely.

retropaganda
Автор

Can we use simple comments to add more annotations to the code to help the static checker? This can help in the areas where the language itself may have not predicted a syntax.

nivo
Автор

You don't need static analysis to turn C++ into a different language.
`-Werror=conversion -Werror=sign-conversion` (or similar for msvc) is a good start already but nobody will go with that as you'll have to add a lot of explicit casts without immediately visible benefit.

Trassr
Автор

24:05 Shouldn’t the auto resolve into “const LargeStruct&” by the compiler? Can “auto” only represent a naked value type?

chefnyc
Автор

It would be nice to open the code for the static analysis tool. That way, more developers can help to grow the list of the checks available.

nivo
Автор

The main message of the video for me was that he's a microsoft employee (repeated at least 50 times) and that we need to talk to their lawyers :-(

retropaganda
Автор

16:10 but this is supported from C++17. Not every project uses it as default today.

jopa
Автор

I prefer C++ to continue having its flexibility. I see it as more of an engineering based language in comparison to Rust I see more as an application language. If the person wants Rust type features in their language they should move to Rust. Why the hell are we discussing Rust in CPP con to start with?

diconicabastion