delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/12/15/04:55:46

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: Where is random()?
15 Dec 1998 04:55:46 -0800 :
Message-ID: <199812150417.WAA12922.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <3673E58E DOT 93F1B604 AT fel DOT cvut DOT cz>
To: Jan Tomasek <xtomasej AT fel DOT cvut DOT cz>
Cc: "gnu-win32 AT cygnus DOT com" <gnu-win32 AT cygnus DOT com>

Jan Tomasek <xtomasej AT fel DOT cvut DOT 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.

`random' is not standard ANSI nor is it part of POSIX. ANSI defines rand 
and srand, and for anything else, unless you're willing to provide your 
RNG (which I do), you can't depend on a target platform to have it.

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. As for the quality, that's a whole
different story.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019