Path: utzoo!attcan!uunet!tank!mimsy!haven!aplcen!osiris!consult From: consult@osiris.UUCP (Unix Consultation Mailbox ) Newsgroups: comp.lang.postscript Subject: Re: ato2pps - possible bug Message-ID: <2747@osiris.UUCP> Date: 21 Dec 88 22:06:21 GMT References: <991@dogie.edu> <1988Dec19.161813.788@mntgfx.mentor.com> Reply-To: consult@osiris.UUCP (Unix Consultation Mailbox (Phil)) Distribution: comp Organization: The Johns Hopkins Hospital, Information Systems Lines: 31 In article <1988Dec19.161813.788@mntgfx.mentor.com> chane@mntgfx.mentor.com (Chane Cullens SPD Engr 526-5267) writes: >From article <991@dogie.edu>, by edwards@dogie.edu ( Mark Edwards): >> t = time(); >Shouldn't this be "t = time( NULL );" Close, and it will usually work. But, it's not portable. Assuming that NULL is defined to 0, the call should be either t = time( (long *) NULL ); or t = time( (time_t *) NULL ); (I kept the uncomfortable coding style intact for consistency) depending on whether you have the time_t typedef. If NULL is not defined to 0, but instead something completely wrong and warning-producing like (char *) 0, beat the person responsible about the head and shoulders with a copy of K&R (either edition). If all else fails, the third possibility is (void) time( &t ); although this will cause some lints to say "long assignment may lose accuracy" (hell yes, I'm trying to lose *all* the accuracy, you nitwit program). Oh yeah, be sure to declare t as long or time_t, whichever is more appropriate. The manpage shows this but lots of programmers get complacent working on machines with 32-bit words. Phil Kos uunet!pyrdc!osiris!phil The Johns Hopkins Hospital