I am working on compiling Cppcheck on AIX with xlC. Each verification class is derived from a class Checkwhose constructor is responsible for registering this type of verification in the global static list.
Here's the relevant part of the code in question (file names link to the full source on Github):
class Check {
public:
Check() {
instances().push_back(this);
instances().sort();
}
static std::list<Check *> &instances() {
static std::list<Check *> _instances;
return _instances;
}
};
class CheckBufferOverrun: public Check {
};
namespace
{
CheckBufferOverrun instance;
}
, _instances static ( check.cpp). g++ , , instances() , , _instances. , .cpp, _instances .
AIX xlC instances() .cpp, , _instances . , _instances, Cppcheck .
?
. , , . , .