This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/13284] 126 g++ failures due to lrand48 not defined


------- Additional Comments From bkoz at gcc dot gnu dot org  2003-12-04 18:44 -------

I think, on balance and after looking at this, that stl_algo.h should just be
using rand.


  /**
   *  @if maint
   *  Return a random number in the range [0, __n).  This function encapsulates
   *  whether we're using rand (part of the standard C library) or lrand48
   *  (not standard, but a much better choice whenever it's available).
   *
   *  XXX There is no corresponding encapsulation fn to seed the generator.
   *  @endif
  */
  template<typename _Distance>
    inline _Distance
    __random_number(_Distance __n)
    {
  #ifdef _GLIBCXX_HAVE_LRAND48
      return lrand48() % __n;
  #else
      return rand() % __n;
  #endif
    }

Ie, this should just be rand, the code collapsed, and the configuration
complexity should be removed.

-benjamin

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13284


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]