This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH] Add simple versions of random() and srandom()
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: Craig Howland <howland at LGSInnovations dot com>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Wed, 23 Mar 2016 10:23:19 -0500
- Subject: Re: [PATCH] Add simple versions of random() and srandom()
- Authentication-results: sourceware.org; auth=none
- References: <1458687116-16115-1-git-send-email-joel at rtems dot org> <56F1DC66 dot 1010804 at LGSInnovations dot com>
On 3/22/2016 6:59 PM, Craig Howland wrote:
On 03/22/2016 06:51 PM, Joel Sherrill wrote:
Prototypes also added for initstate() and setstate() but they
were not implemented.
If they were not implemented, the prototypes should not be there. Or if they
are, commented out as TDB or not supplied as an explicit reminder that they are
Cygwin will be using the prototypes now.
newlib/libc/include/stdlib.h | 6 ++
diff --git a/newlib/libc/stdlib/random.c b/newlib/libc/stdlib/random.c
new file mode 100644
@@ -0,0 +1,86 @@
+<<random>>, <<srandom>>---pseudo-random numbers
+ #include <stdlib.h>
+ long int random(void);
+ void srandom(unsigned int <[seed]>);
The needed '#define _XOPEN_SOURCE 500 /* or any value > 500*/' before the
This results in nested comments and the file doesn't compile. I added
this information as a second note.
#include is missing. (Since the portability section quotes POSIX, I chose a
POSIX gate.) Unless we want to show them in the manner of GLIBC man pages.
Their presentation for random(3):
"Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
random(), srandom(), initstate(), setstate(): _SVID_SOURCE ||
_BSD_SOURCE || _XOPEN_SOURCE >= 500".
Put another way, now that Yaakov cleaned up all the gating, we really should
also clean up the documentation, too, and we need to decide on the approach
which should be taken, since there is not one approach currently.
This is yet another pass. :)
+ #include <stdlib.h>
+ long int rand();
+ void srandon(<[seed]>)
+ unsigned int <[seed]>;
Get rid of the traditional synopsis. It is ignored by the document generation
stuff, so it's better not to have it, to avoid maintaining something that is not
Also added to CHEWOUT_FILES and stdlib.tex.
A v2 should be coming soon. There were lots of comments and I may have