🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Donald L. Nash Mon, 27 Oct 1986 18:52
Why are typedef names in the same name space as variable names?
#9660
Author: Donald L. Nash
Date: Mon, 27 Oct 1986 18:52
24 lines
1363 bytes
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.
Re: Why are typedef names in the same name space as variable names?
#9696
Author: Brian Russ
Date: Sun, 02 Nov 1986 02:26
25 lines
1123 bytes
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.



	
Re: Why are typedef names in the same name space as variable names?
#9751
Author: BEATTIE
Date: Wed, 05 Nov 1986 14:09
16 lines
967 bytes
> 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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads