Re: [ROOT] different exceptions

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Sat May 12 2001 - 17:49:58 MEST


Hi Colin et al, 

On Sat, 12 May 2001 09:23:17 +0200 (CEST)
Colin Bernet <bernet@kph.uni-mainz.de> wrote
concerning ": [ROOT] different exceptions":
> In file included from /usr/include/math.h:64,
>                  from /usr/local/root/include/G__ci.h:268,
>                  from /usr/local/root/include/TSystem.h:31, Colin Bernet
> Tel. +49-6131/39-23192 Fax +49-6131/39-22964
>                  from /usr/local/root/include/TThread.h:38,
>                  from Monitor.h:36,
>                  from MainFrame.h:22,
>                  from gui.cc:6: /usr/include/bits/mathcalls.h:54:
> declaration of `double acos (double) throw ()' throws different exceptions
> /usr/local/root/include/TMath.h:306: than previous declaration `double
> acos (double)' 

Don't include files from /usr/include/bits directly.  Even <sys/...>
should be used with care.  I guess you may have defined some
preprocessor thing after including TThread.h, but before including
bits/mathcalls.h, so that the definitions get all screwd up.  Suppose
you had the header myheader.h

     #ifdef SOME_PP_MACRO
     #define MY_DECL(x) (x) throw() 
     #else 
     #define MY_DECL(x) (x) 
     #endif

     extern int my_func MY_DECL((int));

and you in one file included it as 

     #include "myheader.h" 
     #define  SOME_PP_MACRO 1
     #include "myheader.h" 

Then I guess you'd see the same problem. 

> Everything works fine on a redhat 6.1, with the same root version, so this
> is probably a compiler problem. Would anybody know a trick to get around
> that ?

I'm not 100% positive that it's a compiler bug (Uh, long discussions
there), but I think it's a user problem :-(. 

The work-around, I believe, is to not include <bits/mathcalls.h> but
<math.h> or even <cmath> if you're on a GNU/Linux system. 

Yours, 

Christian  -----------------------------------------------------------
Holm Christensen                             Phone:  (+45) 35 35 96 91 
  Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
  DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
  Denmark                                    Email:       cholm@nbi.dk



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:45 MET