From: dontmailme AT iname DOT com (Steamer) Newsgroups: comp.os.msdos.djgpp Subject: Re: Which library is time in? Date: Wed, 05 Jul 2000 18:40:44 GMT Organization: always disorganized Lines: 22 Message-ID: <39638118.41303400@news.freeserve.net> References: NNTP-Posting-Host: modem-232.utah.dialup.pol.co.uk X-Trace: news7.svr.pol.co.uk 962822445 1878 62.137.95.232 (5 Jul 2000 18:40:45 GMT) NNTP-Posting-Date: 5 Jul 2000 18:40:45 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > > srand(time(NULL)); > > > > If the code is intended to be portable then it's probably better to do > > > > srand((unsigned)time(NULL)); > > > > to prevent warnings on some compilers. > > What warning are those? If you include both time.h and stdlib.h, you > should have no warnings, I think. With DJGPP you won't get any warnings. But I said "if the code is intended to be portable". For example, time_t might be unsigned long, and unsigned long might be longer than unsigned int. In this case the compiler may warn that the conversion could lose significant digits. But with the explicit cast it should assume you know what you're doing and keep quiet. (In fact I just tried this with Turbo C 3.0 and it behaves exactly like this.) S.