chane@mntgfx.mentor.com (Chane Cullens SPD Engr 526-5267) (12/20/88)
From article <991@dogie.edu>, by edwards@dogie.edu ( Mark Edwards): > > > ================ cut here ========================================= > /* > * ato2pps.c ascii to 2 page on one page postscript > * > * 15 Dec 1988 by edwards@dogie.macc.wisc.edu > * Hacked cplai@daisy version and Eric Gisin C code >... ... ... > t = time(); Shouldn't this be "t = time( NULL );" Otherwise it crashes on my apollo and destroys memory on a PC. -- ------------------------------------------------------------------ Chane Cullens | USENET: chane@pdx.MENTOR.COM (503) 626-7000 x2637 (day) | UUCP: ...!mntgfx!bruceh 8500 SW Creekside Place | GENIE: CCULLENS
consult@osiris.UUCP (Unix Consultation Mailbox ) (12/22/88)
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