shared ptr NULL check

Post a reply


This question is a means of preventing automated form submissions by spambots.

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is OFF
Smilies are OFF

Topic review
   

Expand view Topic review: shared ptr NULL check

Re: shared ptr NULL check

by mmetivier » Wed Sep 30, 2020 11:55 pm

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

shared ptr NULL check

by Bob » Wed Sep 30, 2020 9:27 am

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?

Top