mardi 17 mars 2015

How to convert custom class pointer to unsigned int


I need to type cast custom class pointer to unsigned int value. Here is what I tired.



Class A{
};

int main()
{
A* a = foo();
unsigned int handler = reinterpret_cast<unsigned int>(a);
return 0;
}


It gives the warning warning C4302: 'reinterpret_cast': truncation from 'A *' to 'unsigned int'


What it the proper way to overcome this in C++ way




Aucun commentaire:

Enregistrer un commentaire