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

Jim Sullivan jim at sco.COM
Thu May 23 03:31:39 AEST 1991


lothar at tmcsys.UUCP (L. Hirschbiegel) writes:

>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
>
>If you still don't understand: I'll help you! 
>For this little test program:
>
>main()
>{
>time(0L);
>time((long *)0);
>}
>
>the assembler output from my C compiler is:

	< assembly code illustrating that 0L and (long *)0 both map to 0 >

This if from YOUR C compiler.  And on many systems, similar code would be
produced.  But on many systems 0L and (long *)0 are not equal, so writers
of portable code should do the right thing and not assume that the entire
work is the same as their machine.

>
>Repeat after me: IT DOESN'T MATTER :-)

But it does. 

>>I'm always wondering why people can't grasp
>>the difference between a plain integer, a long and pointers to any of it.

Here! Here!


>>Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83
>Lothar Hirschbiegel

-- 
Jim Sullivan				"Revenue Canada:
SCO Canada, Inc.			 	You Make It
Toronto, Ontario, Canada		 	We Take It"
jim at scocan.com, ...!uunet!scocan!jim	- Backbench comic in the Globe



More information about the Comp.lang.c mailing list