Re: ?? warning: ANSI C++ forbids implicit conversion from `void *' in argument passing



The & in front of your function name is the problem.  Try

{
  pthread_t thread;

  pthread_create(&thread, NULL, (void *) doSimulation, NULL);
}

if you declare doSimulation as a void * (ie void *doSimulation(...)) you
can even drop the type cast.

-Michael

On Fri, 15 Feb 2002, Chris Seberino wrote:

>
>    pthread_t thread;
>
>    pthread_create(&thread, NULL, (void*) &doSimulation, NULL);
>
> Help! I trying to assign a function to a thread in my amateur
> PThread calls above.  Without (void*) before function name I get
> an error and WITH (void*) I get following warning:
>
> warning: ANSI C++ forbids implicit conversion from `void *' in argument passing
>
> This would all be harmless except I believe newer GTK+
> or something in my Linux distro upgrade causes BOTH
> (with and without (void*)) to return an error!!!
>
> NEITHER WORKS!!
>
> Is there someway to fix this to avoid errors and warnings??
>
> Chris
>
> --
> =======================================================
> | Dr. Christian Seberino  || (619) 553-7940  (office) |
> | SPAWARSYSCEN 2363       || (619) 553-2836  (fax)    |
> | 53560 HULL ST           ||                          |
> | SAN DIEGO CA 92152-5001 || seberino spawar navy mil |
> =======================================================
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>




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