I am wondering if this is a portable way to print function pointers.
Casting the function pointer directly to unsigned char * is non-portable.
/* writehex() prints the given byte as its hex representation to the given FILE * */
extern void writehex(FILE *, const unsigned char);
/* Theoretical printf() implementation. */
int printf(const char *format, ...) {
...
void (*fptr)(void);
const unsigned char *bytes = (const unsigned char *) &fptr;
size_t i;
fptr = va_arg(ap, ((void)(*)(void)));
for (i = 0; i < sizeof(fptr); ++i)
writehex(stdout, *bytes++);
...
}