C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Memory Safety in C++ via Safe Subset and Static Analysis - Master’s Thesis Summary

From: Thomas Krogh Lohse <tlohse20_at_[hidden]>
Date: Sun, 1 Jun 2025 12:43:55 +0000
> Do you allow C++ references?

The analysis is applied to lvalue-references, and does not consider rvalue-references. With the subset restrictions, it encourages the use of lvalue-references, and discourages the use of pointers.

> Do the smart pointers incur size or speed disadvantages compared to C pointers? I.e. have you just used the type system for annotations or do you change the runtime behavior compared to classic pointers.

This is static analysis, I only leverage the type system at compile time, and has no effect on the runtime of the program. W.r.t. speed of smart pointers vs. classic pointers, that has not been a focus of my thesis, only safety of C++, so I cannot in good faith make any statements of that.

> Do you handle multi-threading?

Not currently, however, I discuss that Rust attributes much of their "thread safety" to their ownership model and the concept of borrowing, and therefore, this project is fairly close give C++ the same guarantees.

> Do you use ownership hierarchies of objects and deduce lifetime?

Yes, I consider objects, though there are a few over-approximations currently (I've outlined potential fixes in my future work).

> Do you use call hierarchies of functions and deduce lifetime?

No, I've implemented Andersens pointer analysis, so it over-approximates here. But it's possible to use another pointer analysis, the dataflow analyses permits this.

> Can code make to pass the tests with annotations or with refactoring?

Functions that would not pass the tests can be attributed with a skip-attribute, and will be ignored by the analysis.



Received on 2025-06-01 12:44:03