dragongame: Pointers are a unique type, and are not the same as any other type. 0 is a special value and is not the same as any literal number because when you convert 0 to a pointer, it MUST become a null pointer, and two null pointers must compare equal.
Note that null pointer and 0 are not the same thing. A 0 becomes a null pointer when converted to a pointer type, but a null pointer can become any value when you convert it to any non-pointer type.
It is perfectly valid for:
void *Pointer = 0;if(unsigned long(Pointer) == 0){ cout << "Pointer is 0";}else{ cout << "Pointer is not 0";}
to print out "Pointer is not 0" because converting a null pointer to an integer is not required to evaluate to 0. The special conversion of 0 is only guaranteed one way (from 0 to null pointer) and the reason comparing a pointer to 0 works is that the only valid automatic conversion is to convert the 0 to a pointer of the same type (so it becomes a null pointer) and then after the conversion the null pointer is compared with your pointer variable.
Casting a pointer to any non-pointer type is not guaranteed to work no matter what integer type you use, except in C where there is a "intptr_t" type defined so that you can convert a void pointer to intptr_t then back to a void pointer and it will have the same value, but there is still no guarantee about what the value will be, or that if you add 1 to the intptr_t that it would point to the next byte, or anything like that. Converting pointers to integers only works because the major vendors decided it should. Counting on such behavior makes a program non-standard.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk