Subject: Re: C lesson
To: <>
From: Rick C. Petty <pett0019@gold.tc.umn.edu>
List: port-mac68k
Date: 03/07/1996 09:39:58
On Wed, 6 Mar 1996, Markus Hitter wrote:

> Maybe I have slept in one of the programming lessons but I can't imagine what
> this 'extern' in front of the function definition does. If I don't comment it
> out this routine is left as a unreferenced symbol. I copied this example from
> ncr5380.c.
> 
> extern __inline__ int wait_req_true(void)
> {

Yes, the extern in front of a function does the same thing as it would in 
front of a variable declaration.  It means to define the function 
externally.  In other words, anything that references the file which this 
declaration takes place will recognize that function as a valid one, when 
it's not defined there.  However, the function must be defined elsewhere 
for it to be valid.  I usually use externs inside header files where I 
want the compiler to know the function exists, but it's defined in some 
other object file, and the linker finds it for me.

The trouble I don't understand is that the function is being DEFINED (not 
declared) here, and I'm not fully sure that "extern" has the same 
semantics where it would be declared, but I'm assuming it does.


--Rick C. Petty,  aka Snoopy
__________________________________________________________
 email: pett0019@gold.tc.umn.edu, pett0019@itlabs.umn.edu
   WWW:     http://www.itlabs.umn.edu/~pett0019/