Where is random()?

Fergus Henderson fjh@cs.mu.OZ.AU
Tue Dec 15 13:18:00 GMT 1998

On 14-Dec-1998, Mumit Khan <khan@xraylith.wisc.edu> wrote:
> Jan Tomasek <xtomasej@fel.cvut.cz> writes:
> > Hi,
> > I'm writing one school project in C and at home I working
> > under CygWin 19.2 
> > 
> > On my Linux (Debian) is on random() man page writen that it is in
> > defined in stdlib.h
> >  * if I compile it with gcc on that linux all is ok
> >  * if I compile it with Cygnus gcc port I get warning:
> Learning standard from man pages is as full of pitfalls as learning a new
> evolving computer language from a compiler.

This is true.  However, if you're going to choose a set of man pages
to learn from, the Debian Linux ones are actually not too bad, because
most of the man pages have a "CONFORMING TO" section which states
which standard(s) support the function(s) in question. 

> `random' is not standard ANSI nor is it part of POSIX.

Right.  For random(), the Debian Linux man page states the following:

	       BSD 4.3

Cygwin provides ANSI C, most of POSIX.1/1990, and some other stuff.
For details, see the "What Unix API calls are supported by Cygwin?"
section of the FAQ list.

> The good news for you is that Cygwin comes with libiberty, which contains 
> a random function. Just add -liberty at the end of the list of libraries
> when you link and you're set for now.

BTW, the FAQ list says that Cygwin supports random() but doesn't
mention the need to link in libiberty.

Fergus Henderson <fjh@cs.mu.oz.au>  |  "Binaries may die
WWW: < http://www.cs.mu.oz.au/~fjh >  |   but source code lives forever"
PGP: finger fjh@        |     -- leaked Microsoft memo.
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

More information about the Cygwin mailing list