Why are typedef names in the same name space as variable names?

P. D. Guthrie pdg at ihdev.UUCP
Thu Dec 4 01:00:26 AEST 1986


In article <4743 at ism780c.UUCP> tim at ism780c.UUCP (Tim Smith) writes:
>Where is this documented?  K&R say that the type may be left out of
>declarations ( giving "int" as the default ).  And they mention a
>problem explicitly with typedefs.  I don't see anywhere that says I
>must specify a type in other cases ( on the other hand, I haven't looked
>very hard.  I may have missed it. ).

Well, I don't see them coming right out and saying it, but it is
strongly implied in the text and enforced in the grammar.
The exceptions are  when you have a storage class identifier (eg
register) or when it is an arg to a function (it defaults to int).

Something interesting that is in the text though is the way that the
default sc-specifiers are assigned.  K&R state that the default is auto
inside a function and *extern* outside.  It seems to be *static* in most
C implementations these days.

-- 

Paul Guthrie					We come in peace,
ihnp4!ihdev!pdg					We bring BEER!



More information about the Comp.lang.c mailing list