Novice question.

Michael J. Eager eager at ringworld.Eng.Sun.COM
Wed Nov 21 12:40:33 AEST 1990


In article <4525 at iitmax.IIT.EDU> gkt at iitmax.IIT.EDU (George Thiruvathukal) writes:
>It is really appalling what can happen when standards groups get their dirty
>paws on something.  I was under the impression that Brian Kernighan and Dennis
>Ritchie designed the C language.  According to the designers of C, an external
>reference is one which occurs "exactly once" and "outside any function."  The
>form presented above for "tentative definition" is an absolutely absurd and
>obscure feature for the insinuation of a forward (or external reference).
>Congratuations to ANSI on a job well done.
>
>I would like to make a small point: an example of external references which 
>are resolved in the same unit of compilation is presented on page 32.  Thanks
>to the ANSI certified confusion, individuals who program in C who once used the
>"extern" as a self-documenting reference to a global variable within a function
>will have no facility for such a purpose.  Clearly, tentative definition does
>not appear to be a well-conceived feature (as explained by Chris Torek) and 
>would certainly suggest different semantics for external references than the
>ones defined on page 31 of K&R.

Dennis Ritchie did define the C language, but it was (and is) not a fixed
perfect creation.  There were several compilers for the C language which
implemented features differently.  K&R has a number of areas which are 
open to interpretation.

External variable linkage is one of those areas where the description in
K&R differed from what the compiler and linker on Unix actually did.  
Most pre-ANSI compilers and linkers would permit multiple definitions of
a variable outside a function, providing that there was only one initializer.
Some others didn't.  At least with the ANSI standard, there is a clear
definition of what is supposed to happen.  And you can still write the 
same code, using the same conventions you were using before.  The standard
mostly affect the obscure cases which were subject to different interpretation
by different compilers.

On another point, C has always had (and needed) forward references.  This
is both in functions and in structure definitions.  I fail to see how this
is an insinuation of anything into the language.

-- Mike Eager



More information about the Comp.lang.c mailing list