print pointer



Hello list, I need to be able to print pointers portably. So on a
32-bit platform I need:

 void *p;

 printf( "pointer = 0x%x\n", (unsigned int) p );

and on x64 I need:

 printf( "pointer = 0x%lx\n", (unsigned long int) p );

glib has G_GSIZE_FORMAT, which is almost what I need, except it's decimal.

Is there a way to do this that I'm missing? Or do I need some configurey?

John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]