[Python-Dev] pthreads question: typedef ??? pthread_t and hacky return statements
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Sat, 19 Aug 2000 00:06:35 +0200
tim wrote:
> > Pure guess on my part -- couldn't imagine why a compiler would warn *unless*
> > bits were being lost.
the compiler doesn't warn about bits being lost -- it complained
because the code was returning a pointer from a function declared
to return a long integer.
(explicitly casting the pthread_t to a long gets rid of the warning).
mark wrote:
> > > In summary, whatever issue there was for OSF/1 six (or so) years ago
> > > appears to be no longer relevant - but there will be the truncation
> > > issue for Win64-like platforms.
> >
> > And there's Vladimir's "volatile" hack.
>
> Wonder if that also is still relevant (was it required because of the
> long * long * cast?)...
probably. messing up when someone abuses pointer casts is one thing,
but if the AIX compiler cannot cast a long to a long, it's broken beyond
repair ;-)
frankly, the code is just plain broken. instead of adding even more dumb
hacks, just fix it. here's how it should be done:
return (long) pthread_self(); /* look! no variables! */
or change
/* Jump through some hoops for Alpha OSF/1 */
to
/* Jump through some hoops because Tim Peters wants us to ;-) */
</F>