Revision cc8edaf7e8e8eff2fc61804b5f00f0d32db7887d authored by Rene Brun on 01 July 2004, 20:02:52 UTC, committed by Rene Brun on 01 July 2004, 20:02:52 UTC
I attached the modifications that are needed in gcc3strm.cxx to compile with gcc 3.4.0.

There are 2 problems.

One is that I could not find any trace of
    ostream& operator<< (ostream&,const streampos&);
in the gcc 3.3.1 or the gcc 3.4.0 header files.
However it is in cint/lib/gcc3strm/iostrm.h and of course in gcc3strm.cxx

The second problem is more fundamental.  In gcc 3.4.0, streamoff is defined
as (include/c++/3.4.0/bits/postypes.h)
  #ifdef _GLIBCXX_HAVE_INT64_T
    typedef int64_t       streamoff;
  #else
    typedef long long     streamoff;
  #endif
in turn int64_t is platform dependent.  In particular, on my node int64_t
is typedef to an int.  In gcc 3.3.1, streamoff was a long.

This leads to the compilation error:

  cint/src/gcc3strm.cxx: In function `int G__G__stream_6_4_0(G__value*, const char*, G__param*, int)':
  cint/src/gcc3strm.cxx:149: error: 'const class std::fpos<mbstate_t>' has no member named 'operator long int'

As a quick fix, I simply replaced the implementatio of the wrapper so
that it does not do an explicit call to the operator long:
   const fpos<mbstate_t>*pos = (const fpos<mbstate_t>*)(G__getstructoffset());
   G__letint(result7,108,(long)(*pos));
instead of
   G__letint(result7,108,(long)((const fpos<mbstate_t>*)(G__getstructoffset()))->operator long());

Of course, this is fundamentally wrong, since on a 64 bit platform, this will truncate the long long
into a long.

I am not sure what would be good solution (theoritically, it would require to make sure that the
dictionary for fpos<mbstate_t> is different (long vs long long) on the appropriate platforms).


git-svn-id: http://root.cern.ch/svn/root/trunk@9367 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 023bf10
Raw File
TRandom.h
// @(#)root/base:$Name:  $:$Id: TRandom.h,v 1.6 2003/11/23 16:13:08 brun Exp $
// Author: Rene Brun   15/12/95

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TRandom
#define ROOT_TRandom



//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRandom                                                              //
//                                                                      //
// Simple prototype random number generator class.                      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif

class TRandom : public TNamed {

protected:
   UInt_t   fSeed;  //Random number generator seed

public:
   TRandom(UInt_t seed=65539);
   virtual ~TRandom();
   virtual  Int_t    Binomial(Int_t ntot, Double_t prob);
   virtual  Double_t BreitWigner(Double_t mean=0, Double_t gamma=1);
   virtual  Double_t Exp(Double_t tau);
   virtual  Double_t Gaus(Double_t mean=0, Double_t sigma=1);
   virtual  UInt_t   GetSeed() {return fSeed;}
   virtual  UInt_t   Integer(UInt_t imax);
   virtual  Double_t Landau(Double_t mean=0, Double_t sigma=1);
   virtual  Int_t    Poisson(Double_t mean);
   virtual  Double_t PoissonD(Double_t mean);
   virtual  void     Rannor(Float_t &a, Float_t &b);
   virtual  void     Rannor(Double_t &a, Double_t &b);
   virtual  void     ReadRandom(const char *filename);
   virtual  void     SetSeed(UInt_t seed=65539);
   virtual  Double_t Rndm(Int_t i=0);
   virtual  void     RndmArray(Int_t n, Float_t *array);
   virtual  void     RndmArray(Int_t n, Double_t *array);
   virtual  void     Sphere(Double_t &x, Double_t &y, Double_t &z, Double_t xlong);
   virtual  Double_t Uniform(Double_t x1=1);
   virtual  Double_t Uniform(Double_t x1, Double_t x2);
   virtual  void     WriteRandom(const char *filename);

   ClassDef(TRandom,1)  // Random number generators
};

R__EXTERN TRandom *gRandom;

#endif
back to top