Xref: utzoo comp.unix.sysv386:8250 comp.lang.c:39430 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.unix.sysv386,comp.lang.c Subject: time(0L) - history of a misconception (was Re: SCO password generator) Message-ID: <1141@mwtech.UUCP> Date: 21 May 91 10:03:31 GMT References: <1991May14.040042.15199@jpradley.jpr.com> <588@sherpa.UUCP> Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 22 In article <588@sherpa.UUCP> rac@sherpa.UUCP (Roger Cornelius) writes: [...] > long seed = time(0L); ^^--------- wrong time((long *)0); ^^^^^^^^^--- right Note that the argument to the time system call is a `long *', aka pointer to long. Repeat after me: POINTER to long. But I've seen this too often, even in examples printed in some manuals. Though I had not much confidence into those particular manuals where I found it (for reasons that probably aren't of any interrest to the readers of this group), I'm curious if anybody has ideas from where this misconception originated. Or, if you have two minutes and you have some source code from which you suppose that it contains a time system call, just grep through it and look if it's done right. I'm always wondering why people can't grasp the difference between a plain integer, a long and pointers to any of it. -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83