Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Does __attribute__((format work for pure virtual function declarations?

$
0
0

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,...);
}

Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>