
On 08/29/2013 09:52 AM, Eric Blake wrote:
#define RAND_MAX 0x7ffffffd
Huh? Why is this not 2**n-1? That violates assumptions we have made, and is WHY your compile failed. It has nothing to do with clang vs. gcc (both compilers would fail), it has to do with your changed system header resulting in violating assumptions that hold in ALL OTHER IMPLEMENTATIONS, that random numbers are evenly distributed within a range of a power of 2.
http://lists.freebsd.org/pipermail/svn-src-head/2013-July/049076.html
makes it look like the reduction in range was _intentional_? Yuck. A non-power-of-2 random generator adds needless complexity to the user.
I also intend to open a bug against POSIX to request that RAND_MAX be required to be 2**n-1, rather than relying on the assumption that everyone so far, until FreeBSD 10, has happened to meet that requirement.
http://austingroupbugs.net/view.php?id=743 -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org