[cfe-dev] Static analyzer: add smart pointer checker
Dmitri Gribenko
gribozavr at gmail.com
Fri Jan 6 07:40:14 PST 2012
Hello,
I want to implement a smart pointer checker (std::shared_ptr,
std::unique) that catches specifying invalid type:
struct A
{
A() { cout << "A()" << endl; }
~A() { cout << "~A()" << endl; }
};
void test()
{
std::unique_ptr<A[]> p(new A[3]); // good, delete[] called
std::unique_ptr<A> p(new A[3]); // bad, delete instead of delete[] called
}
Any comments?
Dmitri Gribenko
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-dev
mailing list