This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/13284] 126 g++ failures due to lrand48 not defined
- From: "bkoz at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Dec 2003 18:44:29 -0000
- Subject: [Bug libstdc++/13284] 126 g++ failures due to lrand48 not defined
- References: <20031203153351.13284.giovannibajo@libero.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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