This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ignorant question about printf warnings for pointer-to-member functions


George Garvey <tmwg-gcc@inxservices.com> writes:

|    This is probably from my ignorance. Is there a proper way to print
| the address below without the warning?

The short answer is: No.

[...]

| g++ -W -Wall -c question.cc 
| question.cc: In function `void f(S&, void (S::*)())':
| question.cc:9: warning: format argument is not a pointer (arg 3)

Indeed.  A pointer to member function is not a pointer.  Any code that
makes the assumption that a pointer to member function maybe be
thought of as a pointer is broken.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]