I am working on creating Cppcheck on AIX using the compiler xlC(see previous question ). All Checker classes are produced from a class Checkwhose constructor registers each object in the global list:
class Check {
public:
Check() {
instances().push_back(this);
instances().sort();
}
static std::list<Check *> &instances();
virtual std::string name() const = 0;
private:
bool operator<(const Check *other) const {
return (name() < other->name());
}
};
class CheckBufferOverrun: public Check {
public:
std::string name() const {
return "Bounds checking";
}
};
, , instances().sort(). sort() Check::operator<(), Check::name() instances() , Check, , ( Check::Check()). , undefined ->name() CheckBufferOverrun.
undefined, ?
: , sort() , , Cppcheck . , , , .
. , , ( ). , , , sort() (, ), , Check::operator<(const Check *) sort()! , sort(), , . g++, xlC, Cppcheck.