Tuesday, January 17, 2012

Resolving warning: cast to pointer from integer of different size

'cast to pointer from integer of different size' This warning message will come while converting in to 64 bit from 32bit..

void *ptr = (void *)myVal;

This declaration gives ' cast to pointer from integer of different size ' warning..

intptr_t or uintptr_t are preferred to resolve this issue.

void *ptr = (void *)(intptr_t) myVal; // This declaration will avoid the warning Msg.


No comments: