[Python-Dev] pthreads question: typedef ??? pthread_t and hacky return statements (original) (raw)
Tim Peters tim_one@email.msn.com
Fri, 18 Aug 2000 18:08:55 -0400
- Previous message: [Python-Dev] pthreads question: typedef ??? pthread_t and hacky return statements
- Next message: [Python-Dev] [Fwd: segfault in sre on 64-bit plats]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[/F]
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 pthreadt to a long gets rid of the warning).
For the umpty-umpth time, the code with the simple cast to long is what was there originally. The convoluted casting was added later to stop "Alpha OSF/1" compiler complaints. Perhaps the compiler no longer complains, though, or perhaps the one or two people who have tried it since don't have a version of the compiler that cares about it.
... 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) pthreadself(); /* look! no variables! */
Fine by me, provided that works on all current platforms, and it's understood that the function is inherently hosed anyway (the cast to long is inherently unsafe, and we're still doing nothing to meet the promise in the docs that this function returns a non-zero integer).
or change
/* Jump through some hoops for Alpha OSF/1 */ to /* Jump through some hoops because Tim Peters wants us to ;-) */
Also fine by me, provided that works on all current platforms, and it's understood that the function is inherently hosed anyway (the cast to long is inherently unsafe, and we're still doing nothing to meet the promise in the docs that this function returns a non-zero integer).
- Previous message: [Python-Dev] pthreads question: typedef ??? pthread_t and hacky return statements
- Next message: [Python-Dev] [Fwd: segfault in sre on 64-bit plats]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]