Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

11 views
Skip to first unread message

Donald L. Nash

unread,
Oct 27, 1986, 1:52:05 PM10/27/86
to
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: dln...@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.

Brian Russ

unread,
Nov 1, 1986, 9:26:47 PM11/1/86
to
In article <42...@ut-ngp.UUCP> dln...@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.


BEATTIE

unread,
Nov 5, 1986, 9:09:32 AM11/5/86
to
> 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.

0 new messages