title: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
body: <p>part of my code:</p>
  
  <pre><code>int server_sockfd, client_sockfd; //socket file descriptors of client and server
  
  // ... some code 
  
  if(pthread_create(&amp;vlakno, NULL, handle_client, (int *) client_sockfd) != 0) {
              perror("Error while creating thread.");
          }
  </code></pre>
  
  <p>I'm getting <strong>"warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]"</strong></p>
  
  <p>prototype of  my function:</p>
  
  <pre><code>void *handle_client(void *args);
  </code></pre>
  
  <p>I found this question: <br/>
  <a href="https://stackoverflow.com/questions/5701450/getting-the-warning-cast-to-pointer-from-integer-of-different-size-from-the-fo">link</a></p>
  
  <p>The first answer said something like that he should use intptr_t instead of int.<br/>
  I have two questions:<br/>
  <strong>What is difference between int and intptr_t in my case? <br/>
  What should I do?</strong> <br/>
  I have 2 ideas:<br/>
  1st: (changing type of file descriptors)<br/> </p>
  
  <pre><code> int server_sockfd, client_sockfd; //socket file descriptors of client and server
  
      // ... some code 
  
      if(pthread_create(&amp;vlakno, NULL, handle_client, (intptr_t *) client_sockfd) != 0) {
                  perror("Error while creating thread.");
              }
  </code></pre>
  
  <p>or 2nd idea: (changing type only in casting function pthread_create) <br/></p>
  
  <pre><code>intptr_t server_sockfd, client_sockfd; //socket file descriptors of client and server
  
          // ... some code 
  
          if(pthread_create(&amp;vlakno, NULL, handle_client, (int *) client_sockfd) != 0) {
                      perror("Error while creating thread.");
                  }
  </code></pre>
  
  <p>EDIT:<br/> 
  in function handle_client i want to do this:</p>
  
  <pre><code>int clientSocket;
  clientSocket = (int)args;
  </code></pre>
  
  <p>I'm really sorry to user cnicar or something like that .. he unfortunatelly deleted his answer but it was ok.
  <br/>
  His solution was use (void *), it firstly casted same same error but it was caused probably bad behaviour of eclipse :(
  So message for him:<br/>
  Ok thanks it looks thats fine now ... Eclipse still throwed this warning but when I turned it on and off twice afer edit it fine with your edit :) thanks a lot </p>