Can I cast void * to ptrdiff_t in C89?

Will the C89 standard allow me to cast void * to ptrdiff_t so I can print the memory location as hexadecimal?

For example:

static const char *dig = "0123456789abcdef";
char buf[16], *ptr = buf; /* Need 16 bytes when sizeof(void *) == 8 */
void *val;
ptrdiff_t tmp = (const unsigned char *) val - (const unsigned char *) 0;

do {
    *buf++ = dig[tmp & 0xf];  
    tmp >>= 4;  
} while (tmp);  

do {  
} while (ptr > buf);  

Context: I am writing a printf() function in kernel space.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum