[PATCH] Add simple versions of random() and srandom()

Craig Howland howland@LGSInnovations.com
Wed Mar 23 14:32:00 GMT 2016


On 03/23/2016 01:04 AM, Yaakov Selkowitz wrote:
> On 2016-03-22 17:51, Joel Sherrill wrote:
>> Prototypes also added for initstate() and setstate() but they
>> were not implemented.
>
> This should allow Cygwin to remove its own declarations of these functions.
>
>> +#if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE
>
> #if __MISC_VISIBLE || __XSI_VISIBLE >= 500
No, the value 4 is actually the right one.  At first look I had also thought 
that it needed to be 500, but it originated in issue 4 as an X/OPEN UNIX 
extension (see 
http://pubs.opengroup.org/onlinepubs/9699919799/functions/random.html), and was 
moved to BASE in issue 5.  features.h has, in part
#elif (_XOPEN_SOURCE - 0) >= 500
#define __XSI_VISIBLE           500
#elif defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)
#define __XSI_VISIBLE           4
I did not directly check the _XOPEN_SOURCE_EXTENDED, but it sounds right, so 4 
does look right.



More information about the Newlib mailing list