digitalmars.D.bugs - [Issue 5271] New: Not constant RAND_MAX
- d-bugmail puremagic.com (23/23) Nov 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5271
- d-bugmail puremagic.com (12/12) Nov 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5271
- d-bugmail puremagic.com (12/12) Nov 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5271
- d-bugmail puremagic.com (15/15) Feb 03 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5271
- d-bugmail puremagic.com (11/11) Feb 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5271
http://d.puremagic.com/issues/show_bug.cgi?id=5271
Summary: Not constant RAND_MAX
Product: D
Version: D2
Platform: x86
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
I think the std.c.stdlib.RAND_MAX (core.stdc.stdlib.RAND_MAX) value is
hardcoded in Phobos, in a line of the two "stdlib.d" files:
enum RAND_MAX = 32767;
If this is true, then it's an error, because in other systems rand() may return
other values. In particular, on an Ubuntu Linux I have seen RAND_MAX needs to
be int.max instead of short.max. So this value has to change according to the
situation.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5271
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla digitalmars.com
12:35:54 PST ---
On ubuntu it is 2147483647.
It still must be hardcoded, as it is a compile time constant, but version'd for
the different platforms.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5271
Iain Buclaw <ibuclaw ubuntu.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ibuclaw ubuntu.com
Having a quick look round, it is 0x7FFFFFFF on FreeBSD and OSX too.
(Hexadecimal value for 2147483647).
Regards
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5271
Lars T. Kyllingstad <bugzilla kyllingen.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla kyllingen.net
Component|Phobos |druntime
AssignedTo|nobody puremagic.com |sean invisibleduck.org
01:25:21 PST ---
std.c.stdlib now just contains a public import of core.stdc.stdlib, so I'm
reassigning this report to druntime. I've also fixed it in my druntime fork
and sent a pull request:
https://github.com/D-Programming-Language/druntime/pull/2
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 03 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5271
Lars T. Kyllingstad <bugzilla kyllingen.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
05:50:02 PST ---
https://github.com/D-Programming-Language/druntime/commit/1006fa114e48147a338f6cee3a0cadfe17e59218
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2011









d-bugmail puremagic.com 