qqiangwu / cppsafe

Cpp lifetime safety profile static analyzer
MIT License
39 stars 1 forks source link

Draft: memory safe cpp subset #57

Open qqiangwu opened 3 months ago

qqiangwu commented 3 months ago

A static analyzer can find bugs in c++ code, but it cannot analyze arbitrary c++ code. For code which cannot be proven right, the analyzer can either:

According to BS's opinion, the second way is preferred to make c++ really safe.

We need to define a formal memory safe cpp subset.

See the WIP Draft. Contributions are welcomed.

qqiangwu commented 3 months ago
struct Pair {
    int x;
    Owner<int> y;
};

const Owner<int>& get(const Owner<Pair>& p)
{
    return p.get().y;
};