Mail Archives: djgpp/1997/10/13/09:22:58
On Sun, 12 Oct 1997, Nate Eldredge wrote:
> Incidentally, which of `random' and `rand' is ANSI?
`rand' is ANSI; `random' is non-ANSI and non-POSIX.
> I'm feeling doubtful about my information on that point as well.
You can easily tell which functions are ANSI and which are POSIX by
looking into the appropriate header that declares their prototype.
Functions whose prototype is BEFORE the #ifndef __STRICT_ANSI__ clause
are ANSI; those between __STRICT_ANSI__ and #ifndef _POSIX_SOURCE are
POSIX; those AFTER _POSIX_SOURCE are neither. This is so invoking GCC
with -ansi or -posix and -Wall will complain about functions which
don't belong to the relevant standard.
> Another question: What is the point of having two different random number
> generators when one is much better?
`rand' is ANSI, so you must have it. You cannot put the code of
`random' inside `rand' because `random's code comes from the BSD
library, which is copyrighted (albeit in public domain), so you cannot
change its name (I think).
- Raw text -