time(0L) - history of a misconception (was Re: SCO password generator)

Sean Eric Fagan sef at kithrup.COM
Thu May 23 04:51:34 AEST 1991


In article <1141 at mwtech.UUCP> martin at mwtech.UUCP (Martin Weitzel) writes:
>In article <588 at sherpa.UUCP> rac at 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.

On the other hand, if you have an ansi-conformant compiler, and a prototype
is in scope, then either solution will work properly.

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef at kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.



More information about the Comp.lang.c mailing list