confusion on globals, externals?

rcd at opus.UUCP rcd at opus.UUCP
Sat Jun 16 14:58:02 AEST 1984


On a tangent from the external-variable discussion...

>He's made the same mistake as several people that sent mail to me
>privately:  he has confused the words "external" and "global".  I did
>not say "global variables are bad", I said "external variables are bad".
>I never said that variables with longer lifetimes than a single function
>invocation are a poor idea...

We've got confused terminology here.  "Global" refers to scope (visibility)
of a variable, not to extent (lifetime).  It means, roughly, "visible
everywhere" just as the name indicates.  "External" also refers to scope;
it means, in C terms, a variable defined in another module.  Given the
scoping rules for C, an external variable IS global.

I believe that the intent was to point out that the problem lies in the
global visibility, not in the static allocation.  I agree here; the need
for global variables is fairly rare and they do admit the possibility of
misuse.
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
	...Cerebus for dictator!



More information about the Comp.unix.wizards mailing list