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

Tim Smith tim at ism780c.UUCP
Tue Dec 2 11:05:59 AEST 1986


In article <3692 at utcsri.UUCP> greg at utcsri.UUCP (Gregory Smith) writes:
>>There is already a problem with telling when the declarations end.
>>Consider this program:
>>
>>	main() {
>>		a;      /* declare an integer variable */
>>		a = 1;  /* put something in it */
>>	}
>>
>In the first example, line 2, 'a;' is a statement, to wit, the
>expression 'a'.  It is an error only because there is no 'a' in scope.
>Declarations inside blocks must specify a type or a storage class.  I
>am not saying that this is perfectly consistent; however it is
>thoroughly documented.

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. ).

-- 
emordnilapregnolanalpanama

Tim Smith       USENET: sdcrdcf!ism780c!tim   Compuserve: 72257,3706
                Delphi or GEnie: mnementh



More information about the Comp.lang.c mailing list