Re: [ROOT] exceptions, threads and redhat 7

From: Joern Adamczewski (J.Adamczewski@gsi.de)
Date: Tue May 15 2001 - 10:41:03 MEST


Hi Colin,

concerning the problem with the non static memberfunction as a TThread,
you are right: the trick used to work by chance with older versions of
the
gcc compiler (in contrast to the C++ compiler "standard", as Victor
pointed out);
however, the latest gcc does not accept that anymore.

Further comments on this you can find in the latest version of the 
ROOT users guide (v07); see the TThread chapter on p. 320- (in the pdf
version).

Instead of a global function as workaround (solution of Andreas
Zoglauer),
you may use in a similar way a static function of the class which calls
non
static functions of the calling instance using the "this" pointer
argument.
(see the ROOT users guide).

Best regards,

        Joern

Colin Bernet wrote:
> -The first one looks to be related to the fact that the compiler (gcc
> version 2.96) doesn't accept anymore the following trick :
>      mTh= new TThread("memberfunction",
>                       (void(*) (void *))&Thread0,
>                       (void*) this);
> 
> on RH6.1, I just get a warning message like:
> Myclass.cxx:98: warning: converting from `void (Myclass::*)(void *)' to
> `void *' )
> 
> on RH7.0, this is unfortunately an error :
> 
> TThreadframe.cxx: In method
> `Int_t TThreadframe::Threadstart ()': TThreadframe.cxx:129: ISO C++
> forbids taking the address of a non-static member function to form a
> pointer to
> member
> function.  Say `&TThreadframe::Thread0'


-- 
/////////////////////////////////////////////////////////////////////
// Dr. J"orn Adamczewski                    (J.Adamczewski@gsi.de) // 
// GO4 project team                         Tel: +49-06159-71-2554 //
// Datenverarbeitung & ExperimentElektronik FAX: +49-06159-71-2986 //
// Ges. f. SchwerIonenforschung, Planckstr.1,  D-64281 Darmstadt   //



This archive was generated by hypermail 2b29 : Fri Jun 08 2001 - 11:51:24 MEST