Xref: utzoo comp.unix.sysv386:8292 comp.lang.c:39466 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!hellgate.utah.edu!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.unix.sysv386,comp.lang.c Subject: Re: time(0L) - history of a misconception (was Re: SCO password generator) Message-ID: <13455@dog.ee.lbl.gov> Date: 22 May 91 17:28:19 GMT References: <1991May14.040042.15199@jpradley.jpr.com> <588@sherpa.UUCP> <1141@mwtech.UUCP> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 38 X-Local-Date: Wed, 22 May 91 10:28:20 PDT In article <1141@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: >... I'm curious if anybody has ideas from where this misconception >[about the type of the argument to time()] originated. Perhaps it dates back to Version 6 Unix, when C did not have a `long' type. The time() system call took a pointer to the first of two `ints'. In V7 this became a pointer to a long, but of course in V6 pointers and integers were freely interchangeable, and people wrote such gems as struct xxreg { int csr; /* control/status */ int bar; /* unibus address */ }; ... 0177440->bar = bp->b_addr; 0177440->csr = XXREAD | XXGO; One can speculate that `long' went in before `pointers are not ints', and people changed their time(vec); calls to t = time(0); calls, but for backwards compatibility the time() function still accepted pointers. It still does; it should be `time_t time(void)', but compatibility with 20-year-old software is oh so terribly important :-) . Perhaps if dmr is indulging his news habit and sees this, he might comment.... -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov