Proper use of "extern" ...

Davidsen davidsen at steinmetz.UUCP
Fri Jun 13 03:41:14 AEST 1986


I just tried the declaration
  static int foo();
on SysV, BSD, XENIX/286, and a couple of spare C compilers laying around. They
all loved it. Even lint accepts it. This has to qualify as current practice,
at least.

I do know of two compilers which will not let you say extern and then
change to static later in the program, so this is not universal
practice.

X3J11 talked about a program like:

static foo();

part1() {
  extern foo();

  foo(20);
}

part2() {
  foo(20);
}

static foo(n)
  int n;
{
  mumble(n+1);
}

in terms of which 'foo' is called in part1. Since declarations inside a
procedure mask global declarations, if 'foo' inside part1 another foo,
which is extern?

I left X3J11 after 2 years and I can't find anthing in the latest
version of the standard I have (I keep getting the March 85 version
from CBEMA) which would clarify the issue.
-- 
	-bill davidsen

  ihnp4!seismo!rochester!steinmetz!--\
                                       \
                    unirot ------------->---> crdos1!davidsen
                                       /
         sixhub ---------------------/        (davidsen at ge-crd.ARPA)

"Stupidity, like virtue, is its own reward"



More information about the Comp.lang.c mailing list