Is it possible to directly type-caste a void pointer to long without causing a trouble? Below is a little code snippet I extracted from the code here (Example under Pthread Joining section of the page).
{
void *status;
long t;
rc = pthread_create(&thread[t], &attr, BusyWork, (void *)t);
rc = pthread_join(thread[t], &status);
printf("Main: completed join with thread %ld having a status of %ld\n",t,(long)status);
}
As this manual page says that pthread_join() copies the exit status of the target thread (i.e., the value that the target thread supplied to pthread_exit()) into the location pointed to by *retval(*status in this case). But in the program I mentioned in question, status doesn't point to any location. Then how is it that the program still works?
And secondly,as far as my knowledge is concerned, status cannot hold a long value then how does typecasting status gives us a value which is long and not an address?