Convert "void*" to int without warning
<p>I need to convert "void*" to int, but compiler keeps giving me warning.
Wonder if there is a way to change the code so that compiler will not complain. This occurs a lot in the code base, especially when passing an argument to starting a new thread.</p>

<pre><code>$ g++ -fpermissive te1.cc
te1.cc: In function ‘void dummy(void*)’:
te1.cc:4:15: warning: cast from ‘void*’ to ‘int’ loses precision [-fpermissive]
  int x = (int)p;
               ^
</code></pre>

<p>Here is the simple code "te1.cc":</p>

<pre><code>#include &lt;stdio.h&gt;

extern void someFunc(int);
void dummy(int type, void *p) {
    if (type == 0) {
        int x = (int)p;
        someFunc(x);
    } else if (type == 1) {
        printf("%s\n", (char*)p);
    }
}

int main(int argc, char *argv[]) {
    void *p = (void*)5;
    dummy(p);
    return 0;
}
</code></pre>

<p><strong>UDPATE1</strong></p>

<p>I understand that I will lose precision. It's intended sometimes. What I need is to have a way to remove the warning in places I know for sure it's safe.  Sorry for not making it clear earlier.</p>

<p><strong>UDPATE2</strong></p>

<p>Updated the code snippet to be a little less non-trivial to illustrate the point. The parameter needs to pass different type of values. I need a way to cast without generating warning.  </p>