Novice question.

George Thiruvathukal gkt at iitmax.IIT.EDU
Fri Nov 16 16:45:08 AEST 1990


In article <27700 at mimsy.umd.edu>, chris at mimsy.umd.edu (Chris Torek) writes:
> In article <4524 at iitmax.IIT.EDU> gkt at iitmax.IIT.EDU (George Thiruvathukal)
> writes:
> >extern int TempCount;
> 	... code using TempCount ...
> >/* resolution of TempCount in same compilation unit */
> >int TempCount = 5;
> 
> ANSI C has made this form illegal, and requires compilers to handle
> this form instead:
> 
> 	int TempCount;	/*T*/
> 	... code using TempCount ...
> 	int TempCount = 5;
> 
> The line marked /*T*/ is called a `tenative definition' in X3.159-1989-ese.
> -- 
> In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750)
> Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris

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.

George Thiruvathukal
gkt at iitmax.iit.edu



More information about the Comp.lang.c mailing list