Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-10-11 10:04:59


--- In boost_at_y..., Karl Pitrich <pit_at_r...> wrote:
>

> libs/thread/build/../src/once.cpp:88: cannot convert `void (*) ()'
> to
> `const void *' for argument `2' to `pthread_setspecific (unsigned
> int,
> const void *)'
>

I did not yet comile once.cpp before, but tried it now:

GCC 3.0.1 is more informative:

home/helmut/dev/mylibs/boost/libs/thread/src/once.cpp: In function
`void
   do_once()':
/home/helmut/dev/mylibs/boost/libs/thread/src/once.cpp:41: ISO C++
forbids
   casting between pointer-to-function and pointer-to-object
/home/helmut/dev/mylibs/boost/libs/thread/src/once.cpp: In function
`void
   boost::call_once(void (*)(), once_flag&)':
/home/helmut/dev/mylibs/boost/libs/thread/src/once.cpp:88: cannot
convert `void
   (*)()' to `const void*' for argument `2' to `int
   pthread_setspecific(unsigned int, const void*)'

As I understand, this might be a real problem:

A pointer to a function is needed as thread specific data,
pthreads assumes that all data can be casted to void*,
and ISO C++ forbids
casting between pointer-to-function and pointer-to-object :-(

Helmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk