Re: How are stdlib.h and time.h imported?
Re: How are stdlib.h and time.h imported?
- Subject: Re: How are stdlib.h and time.h imported?
- From: Frédéric Testuz <email@hidden>
- Date: Mon, 20 Aug 2007 21:06:15 +0200
Le 20 août 07 à 20:37, Frank Bettger a écrit :
Started to read Hillegass book,
In his first example he uses three C functions random() , srandom and
time(). But he doesn't explain much where they come from or how the
compiler
finds them. Not knowing so much about C, I tried to look them up
from Xcode
by choosing Help->Documentation and then searching for these words.
Here's
what I've found.
#include <stdlib.h>
long random(void);
void srandom(unsigned long seed);
#include <time.h>
time_t time(time_t *tloc);
Here is my question
How does the compile find random() and time(). According to the
docs you
should import stdlib.h and time.h, but Hillegass code does not
import any of
them. The only thing imported in Hillegass code is <Cocoa/Cocoa.h>,
and I've
looked in that file and do not see any imports of time.h and stdlib.h?
Cocoa.h imports Foundation.h.
Foundation.h includes CoreFoundation.h
CoreFoundation.h includes stdlib.h and time.h
Then when you import Cocoa.h, you include stdlib.h and time.h (and
many others).
Fred
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden