I have a base class and a derived class with following function declarations
class Base{
public:
virtual int myFunction(const char* zFormat,...) = 0;
}
class Derived : public Base{
public:
virtual int myFunction(const char* zFormat,...);
}
I want to check the format arguments in build time using GCC __attribute__((format macro,
To do this, would it be enough to call it in Base class declaration?
class Base{
public:
__attribute__((format(printf, 2, 3))) virtual int myFunction(const char* zFormat,...) = 0;
}
or since this is pure virtual I need to call it in all the child classes.
class Base{
public:
virtual int myFunction(const char* zFormat,...) = 0;
}
class Derived : public Base{
public:
__attribute__((format(printf, 2, 3))) virtual int myFunction(const char* zFormat,...);
}