This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Ignorant question about printf warnings for pointer-to-member functions
- From: George Garvey <tmwg-gcc at inxservices dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 30 Nov 2002 09:54:06 -0800
- Subject: Ignorant question about printf warnings for pointer-to-member functions
- Organization: inX Services, Los Angeles, CA, USA
This is probably from my ignorance. Is there a proper way to print
the address below without the warning?
#include <cstdio>
struct S {
void F(void);
};
void
f(S &s, void (S::*f)(void)) {
printf("f(%p,%p)\n", &s, f);
}
int
main() {
S s;
f(s, &S::F);
return 0;
}
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)