Re: 2.1.22 unneeded global symbols

Thomas Koenig (
Mon, 27 Jan 1997 20:08:11 +0100 (MET)

Alan Cox wrote:

>> If you want to pass a pointer to a variable to somewhere else, it doesn't
>> have to be extern; it can be made static.
>Mnay of the network pointers are passed from other files in the network

If you pass the address of object to another compilation unit
(i.e. source file), this object does not need to be extern; it
can be static or allocated (but NOT automatic).

We're probably not discussing the same subject, or else I'm not getting

Let's take another example, which is also perfectly valid C:


char *hello_fcn(void);


#include "hello.h"

static char msg[]="Hello, world!\n";

char *hello_fcn(void)
return msg;


#include <stdio.h>

#include "hello.h"

int main()
char *mymsg;

msg = hello_fcn();
return 0;

In this example, msg does not have to be extern; static is fine.

Thomas Koenig,, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.