[net.lang.c] Why are typedef names in the same name space as variable names?

dlnash@ut-ngp.UUCP (Donald L. Nash) (10/27/86)

Why are typedef names in the same name space as variable names?  In C
this presents very few problems, but in C++ it causes problems.  Since
class names are implicitly made into typedef names, they are also in the
same name space as variable names.  This means that you cannot have
something like:

	struct foo { /* ... */ };

	int foo;

in C++.

I know it is really too late to change anything, but I'm still curious why C
was made this way.  Speak up, BWK and DMR!!! :-)  Flames to /dev/null, please.

				Don Nash

UUCP:    ...!{ihnp4, allegra, seismo!ut-sally}!ut-ngp!dlnash
ARPA:    dlnash@ngp.CC.UTEXAS.EDU
BITNET:	 CCEU001@UTADNX, DLNASH@UTADNX

    Two wonderful facts to lighten your day:
        1.  The world is basically non-linear.
        2.  The entropy of the universe is increasing.

bruss@sdcsvax.UCSD.EDU (Brian Russ) (11/02/86)

In article <4220@ut-ngp.UUCP> dlnash@ut-ngp.UUCP (Donald L. Nash) writes:
>Why are typedef names in the same name space as variable names? ... 
> ...  This means that you cannot have
>something like:
>
>	struct foo { /* ... */ };
>
>	int foo;
>
>in C++.
>

	If they weren't in the same name space, you could, in addition
to the above, write:

	struct foo { /* ... */ };

	foo foo;

	Yuch!  Do you really want/need this flexibility?  In my opinion,
it's better the way it is now.



	

twb@hoqax.UUCP (BEATTIE) (11/05/86)

> Why are typedef names in the same name space as variable names?  In C
> this presents very few problems, but in C++ it causes problems.  Since
> class names are implicitly made into typedef names, they are also in the
> same name space as variable names.  This means that you cannot have
> something like:
> 
> 	struct foo { /* ... */ };
> 
> 	int foo;
> 
> in C++.
> 				Don Nash

To avoid things like:
	foo foo;
Tom.