You do need, however, to question why you need to do such comparisons in the first place.
In both C and C++, a conversion of any pointer type (such as char *) to a void pointer (void *) is implicit - the compiler will do the conversion, without being told to, and without complaining. In C, the reverse (implicit conversion of a void * to a char *) is also permitted - this is not permitted in C++.
A comparison of a void * with a char * is permitted indirectly: the char * is implicitly converted to a void *, and then the two void pointers are compared. If you know the void * is actually a char *, all is fine. If it is an integral value (or if it is a pointer to some type other than char) the comparison yields undefined behaviour.
It is possible to force the issue by an explicit type conversion (such as a reinterpret_cast) but such tricks are often not a good idea.
In your case, shutting up the compiler is the least significant part of your problem - and, apparently, the only problem you are accounting for.
The other problem - which you have not addressed - is ensuring that the value in the pointer was an integer in the first place. Otherwise, the code will exhibit undefined behaviour. For example;
Code:
void *val = reinterpret_cast<void *>(42);
if (42 == reinterpret_cast<int>(val))
or, equivalently, if you are passing void pointers as arguments to functions
Code:
void *callback(void *val)
{
if (42 == reinterpret_cast<int>(val)) whatever();
}
// and to call it
int main()
{
callback(reinterpret_cast<void *>(42));
}
The problem is that both of these code fragments do a round-trip conversion (convert an int (42) to void * and back again). Such round-trip conversions are not guaranteed to work (which is why the compiler complains on at least one of the conversions, unless you bludgeon it into submission with an explicit type conversion). Formally, once you have bludgeoned the compiler into submission, the code actually exhibits undefined behaviour. Informally, if a void * is larger than an int are the same size, there is a chance that the value 42 will survive the round-trip conversion. The problem is that there are real-world compilers that support an int larger than a void * - the round-trip conversion does not work with such compilers.
Generally, if you are going to use any explicit type conversions (a C-style cast or, in C++, the _cast operators) you need to do some analysis akin to my examples above, and pick a compiler appropriately, to ensure validity of your code.