[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

(Re)Build problem with g++ 4.0



Hi,

first of all: if this is not the appropriate list for this kind 
of question, please give me pointer to better one.

I am having problems with rebuilding my dcmtk package with g++
4.0 on Sid. The problem seems to be related to type casting
between pthread_t and unsigned long int types and vice versa by 
means of the `reinterpret_cast < > () operator'. With g++ 3.3 the 
package builds fine right out of the box.

Here is a bare bone example to illustrate the problem:

jsa@charlotte:~$ cat thread2.cc

#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>

void *thread_func(void *arg);

int main() {
    pthread_t a_thread;
    unsigned long dummy;
    void *thread_result;

    pthread_create(&a_thread, NULL, thread_func, NULL);
    dummy = reinterpret_cast <unsigned long> (a_thread);
    pthread_join(a_thread, &thread_result);
    exit(EXIT_SUCCESS);
}

void *thread_func(void *arg) {
    sleep(3);
    pthread_exit(0);
}

jsa@charlotte:~$ /usr/bin/g++-3.3 -Wall -D_REENTRANT thread2.cc -o thread2 -lpthread
jsa@charlotte:~$ /usr/bin/g++-4.0 -Wall -D_REENTRANT thread2.cc -o thread2 -lpthread
thread2.cc: In function 'int main()':
thread2.cc:13: error: invalid cast from type 'pthread_t' to type 'long unsigned int'
jsa@charlotte:~$

Any ideas?

Regards - Juergen

-- 
GPG A997BA7A | 87FC DA31 5F00 C885 0DC3  E28F BD0D 4B33 A997 BA7A

Attachment: signature.asc
Description: Digital signature


Reply to: