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]

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


   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)


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