Common block-like implementation of C extern variables

guido at boring.UUCP guido at boring.UUCP
Tue Jan 1 01:53:09 AEST 1985


[Couldn't mail this, so for everybody's enjoyment...]

I remember having read that this was indeed the intended implementation.
Unfortunately, on the first machine where it was tried (an IBM), it failed
because the loader reserved an incredible area (such as 2048 bytes or so)
for each common block, and furthermore could only handle a fairly limited
number of common blocks -- the reason being, of course, that in Fortran
variables are grouped in common blocks and there are on the average only
'a few', usually large, common blocks per group of cooperating routines.
In C, each variable would have to have its own common block, so these
statistics get somewhat reversed...  I think there are more systems where
the loader makes such assumptions about common blocks.

On the other hand, the implementation of extern variables as 'entry points'
in load modules poses no such problems, as this is supported by almost every
assembler in the world (no flames please).  The requirement that storage
is defined for a variable exactly once is present in most languages, and
it has never been a problem for functions.  The problem is really just
one of compatibility with UNIX every-day life.

	Guido van Rossum, "Stamp Out FORTRAN" Committee, CWI, Amsterdam
	guido at mcvax.UUCP



More information about the Comp.lang.c mailing list