The cast is necessary in order to implement support for the '%p' printf format specifier on targets on which the pointer size is not the same as that of type 'int'.