safety regarding a union of a pointer with a unique integer id

  associations, c++, pointers, union
typedef union {void *ptr; int id;} handle;

This is unsafe, correct?

I see that a unique id is based on the memory location value of a 64-bit pointer. The unique id then can be used to match upon or vice-versa the pointer could be used upon a matching "id".

It seems to be ok, but I’d rather ask the pro’s.

Source: Windows Questions C++