shared ptr NULL check

PC-lint Plus User Discussion
Post Reply
Bob

shared ptr NULL check

Post by Bob »

We use PC-lint Plus 1.3.5 on X86_64 Linux system, does PC-lint support shared pointer NULL check?
For example:

Code: Select all

#include <memory>
#include <iostream>
struct A{
    int a{0};
};

int main(int argc, const char *argv[]) {
    std::unique_ptr<A> p;
    std::cout << p->a << std::endl;

    std::cout << p.get()->a << std::endl;


    return 0;
}

For above code, when compile and run, it surely will abort, can PC-lint support NULL pointer check?
mmetivier

Re: shared ptr NULL check

Post by mmetivier »

The online demo at https://gimpel.com/demo.html would seem to indicate "no".
Post Reply