Amos Jeffries, le lun. 06 oct. 2025 08:54:41 +1300, a ecrit:
> On 06/10/2025 08:31, Diego Nieto Cid wrote:
> > Hello,
> > 
> > So in the hurd package build log there appears this couple of log
> > messages:
> > 
> >      ../../nfsd/loop.c: In function 'server_loop':
> >      ../../nfsd/loop.c:41:12: warning: cast from pointer to integer of 
> > different size [-Wpointer-to-int-cast]
> >         41 |   int fd = (int) arg;
> >            |            ^
> > 
> >      ../../nfsd/main.c: In function 'create_server_thread':
> >      ../../nfsd/main.c:47:54: warning: cast to pointer from integer of 
> > different size [-Wint-to-pointer-cast]
> >         47 |   fail = pthread_create (&thread, NULL, server_loop, (void *) 
> > socket);
> >            |
> > 
> > Is there really no way to get this warning fixed? It looks like the standard
> > way of passing generic arguments to a thread function. So we'll probable 
> > need
> > to live with it.
> 
> 
> AFAIK those should be coded like this:
> 
> main.c:
>    fail = pthread_create (&thread, NULL, server_loop, &socket);
> 
> loop.c:
>    int fd = *( (int *) arg);

That's needlessly problematic: you then have to make sure that socket
still exists while the thread accesses *(int*)arg. While you can indeed
cast the integer to pointer, and back to integer, it'll be preserved.

Samuel

Reply via email to