Xref: utzoo comp.unix.sysv386:8263 comp.lang.c:39440 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unido!aega84!tmcsys!lothar From: lothar@tmcsys.UUCP (L. Hirschbiegel) Newsgroups: comp.unix.sysv386,comp.lang.c Subject: Re: time(0L) - history of a misconception (was Re: SCO password generator) Message-ID: <381@tmcsys.UUCP> Date: 21 May 91 22:27:59 GMT References: <1991May14.040042.15199@jpradley.jpr.com> <588@sherpa.UUCP> <1141@mwtech.UUCP> Reply-To: lh@aega84.UUCP (L. Hirschbiegel) Organization: Private Site Lines: 72 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 > You're a cousin of "lint", aren't you :-) ? >Note that the argument to the time system call is a `long *', aka >pointer to long. Ever tried to RTFM for yourself? NAME time - get time DESCRIPTION The time system call returns the value of time in seconds since 00:00:00 Greenwich Mean Time (GMT), January 1, 1970. If tloc is non-zero, the return value is also stored in the ^^^^^^^^^^^ location to which tloc points. 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: .file "main.c" gcc_compiled.: .text .align 4 .globl main main: pushl %ebp movl %esp,%ebp pushl $0 call time pushl $0 call time .L1: leave ret >Repeat after me: POINTER to long. Repeat after me: IT DOESN'T MATTER :-) >I'm always wondering why people can't grasp >the difference between a plain integer, a long and pointers to any of it. So do I... >-- >Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83 Lothar Hirschbiegel -- ----------------------------------------------- L. Hirschbiegel, AEG - A84, Frankfurt (Germany) email: unido!aega84!lh tel: -49-69-66414316 -----------------------------------------------