Defaul-NULL pointer Error

Peter Kümmel syntheticpp at gmx.net
Sun Jan 9 13:18:32 CET 2005


Hello,

yesterday I've fixed a error in QPrinter::setup(QWidget* parent = 0)
which originates in usage of a default-NULL pointer.
Maybe there are more such bugs in our code.
The structure of the bug looks like the following example code:


struct TT{
     int d;
};

int ttt( TT* t = 0){
     return  t->d;
}

int main( int argc, char** argv )
{
     int i = ttt(); // <- Segmentation fault
     return 0;
}


I think this bug could be found by a compiler. Does anybody know
a compiler warning  or compiler which detects such bugs?
(g++ -Wall does not help)

Peter





More information about the kde-cygwin mailing list