Xref: utzoo comp.unix.sysv386:8325 comp.lang.c:39499 Newsgroups: comp.unix.sysv386,comp.lang.c Path: utzoo!censor!comspec!scocan!jim From: jim@sco.COM (Jim Sullivan) Subject: Re: time(0L) - history of a misconception (was Re: SCO password generator) Organization: SCO Canada, Inc. Date: Wed, 22 May 1991 17:31:39 GMT Message-ID: <1991May22.173139.389@sco.COM> References: <1991May14.040042.15199@jpradley.jpr.com> <588@sherpa.UUCP> <1141@mwtech.UUCP> <381@tmcsys.UUCP> Sender: news@sco.COM (News administration) lothar@tmcsys.UUCP (L. Hirschbiegel) writes: >In article <1141@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: >>In article <588@sherpa.UUCP> rac@sherpa.UUCP (Roger Cornelius) writes: >>[...] >>> long seed = time(0L); >> ^^--------- wrong >> time((long *)0); >> ^^^^^^^^^--- right > >If you still don't understand: I'll help you! >For this little test program: > >main() >{ >time(0L); >time((long *)0); >} > >the assembler output from my C compiler is: < assembly code illustrating that 0L and (long *)0 both map to 0 > This if from YOUR C compiler. And on many systems, similar code would be produced. But on many systems 0L and (long *)0 are not equal, so writers of portable code should do the right thing and not assume that the entire work is the same as their machine. > >Repeat after me: IT DOESN'T MATTER :-) But it does. >>I'm always wondering why people can't grasp >>the difference between a plain integer, a long and pointers to any of it. Here! Here! >>Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83 >Lothar Hirschbiegel -- Jim Sullivan "Revenue Canada: SCO Canada, Inc. You Make It Toronto, Ontario, Canada We Take It" jim@scocan.com, ...!uunet!scocan!jim - Backbench comic in the Globe