Computing.Net > Forums > Programming > C++ cast problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

C++ cast problem

Reply to Message Icon

Name: Stephan
Date: August 13, 2002 at 03:43:11 Pacific
Comment:

I am writing a C++ program using pthreads and
searching for a CLEAN way to cast void*(someclass::*)(void*) to void*(*)(void*). The following example works but produces warnings.

Example:

class someclass
{
public:
someclass()
{
pthread_t tid;
pthread_create(&tid,0,
((void *)(*)(void*))
&someclass::a,0);
}

void* a(void *arg)
{
return 0;
}
}

Thanks for all help in advance.



Sponsored Link
Ads by Google

Response Number 1
Name: cup
Date: August 13, 2002 at 05:32:27 Pacific
Reply:

someclass::a needs to be static

class someclass
{
public:
someclass()
{
pthread_t tid;
pthread_create(&tid,0,someclass::a,0);
}

static void* a(void *arg)
{
return 0;
}
}



0

Response Number 2
Name: Michael Morgan
Date: August 14, 2002 at 00:49:26 Pacific
Reply:

My kazaa opens automatically &
i don't want it too everytime i turn on my
computer


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Displaying value in 2 tex... Problem related with Wind...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ cast problem

simple C++ compile problem in Linux www.computing.net/answers/programming/simple-c-compile-problem-in-linux-/1282.html

C++ Homework problem www.computing.net/answers/programming/c-homework-problem/8556.html

MATLAB C++ Linking problems www.computing.net/answers/programming/matlab-c-linking-problems/8977.html