This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: STL std::random_shuffle behavior fails with lrand48 (workaround)
- From: Jim Kleckner <jek-cygwin at kleckner dot net>
- To: sailorleo at isonews2 dot com
- Cc: cygwin at cygwin dot com
- Date: Mon, 02 Aug 2004 15:01:06 -0700
- Subject: Re: STL std::random_shuffle behavior fails with lrand48 (workaround)
- References: <410AEF64.90409@kleckner.net> <410B038D.5010507@isonews2.com>
Arturus Magi wrote:
Jim Kleckner wrote:
Version of cygwin is current (see attached file
for all version stamps)
gcc 3.3.1-3
gcc-g++ 3.3.1-3
version of gcc/g++ on Linux is 2.96.
The test program is attached as is cygcheck output.
To run it just type (note that -mno-cygwin is *not* used):
g++ xxx.cpp
./a.exe
Is this a configuration issue? Or does lrand48 not work?
Or is it a long vs. int type mismatch?
Try upgrading the version of gcc on the Linux box before comparing.
There are a number of differences between gcc2 and gcc3 that may be
affecting things.
It is not possible to upgrade that server in order
to confirm that the bug is general to gcc3.
If someone else could demonstrate that
the bug exists on other platforms, I would
be grateful.
For other people who run into this, I found that
substituting rand() for lrand48() works around
this problem. Add this code ahead of the includes
of <algorithm> and so forth.
Not pretty but it removed the roadblock.
Jim
// This lrand48() hack is a workaround for cygwin lrand48()
extern "C" long int lrand48();
extern "C" int rand();
long int lrand48()
{
return rand();
}
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/