ctime() revisited and another question
    sloane at noscvax.UUCP 
    sloane at noscvax.UUCP
       
    Mon Apr 16 23:35:01 AEST 1984
    
    
  
Thanks much for the many responses to my query about the  ctime()
argument types.
I received several responses:
1.  Lint is wrong, ignore it and type the argument as a long
2.  Lint is right, the argument should be declared  as  a  time_t
    and on a VAX it should be an int
3.  Lint is right and sys/types.h is wrong, the  argument  should
    be declared  as  a  time_t  and  a time_t should be a long in
    sys/types.h
Answer 3 (change sys/types.h to type time_t as  a  long)  is  the
correct  one,  which  now brings up another question (which in my
profound ignorance I will ask of you ladies and gents): but first
some background.
The most cogent reponse to  my  ctime()  question  was  that  the
time_t  typedef  is designed to make calls to ctime() portable to
other machines; that  is,  by  using  a  time_t  declaration  and
#including  <sys/types.h>  I would be doing things 'properly', as
the types.h file is modified to be  appropriate  to  the  machine
architecture  it  appears on.  I had not heard of a time_t (or of
sys/types.h,  I  told  you  I  was  ignorant)  until  I   started
scrounging  around  trying  to solve my original ctime() vs. lint
problem.
So  now  my   question:   Just   where   in   all   that   4.2bsd
'documentation' is the proper use of types.h mentioned?  I assume
that there are  SEVERAL  places  where  I  should  routinely  use
types.h  if I want to do things correctly, but is the only way to
find out by inspection?  There was no mention of types.h  in  the
ctime() man page, I was just lucky to stumble onto it...  And are
there  other  #include  files  that  I  should  know  about?  I'd
appreciate pointers...
Send 'em to me via e-mail and if I get enough, maybe I'll post it
to the net.unix people...
"I must be blind, 'cause I sure as hell can't C..."
      Gary K. Sloane
      c/o Naval Ocean Systems Center
      COTD Building 1 Room B205
      San Diego, California 92152
      MILNET: sloane at nosc
      UUCP:   ...{sdcsvax}!noscvax!sloane
      DDD: (619) 225-8401 x391
    
    
More information about the Comp.unix.wizards
mailing list