Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!smoke!rbj@icst-cmr From: rbj@icst-cmr (Root Boy Jim) Newsgroups: net.lang.c Subject: Re: unique namespace for typedefs, struct names, struct tags? Message-ID: <1774@brl-smoke.ARPA> Date: Thu, 13-Mar-86 12:38:20 EST Article-I.D.: brl-smok.1774 Posted: Thu Mar 13 12:38:20 1986 Date-Received: Sat, 15-Mar-86 19:04:34 EST Sender: news@brl-smoke.ARPA Lines: 35 I recently ran into a problem with a C compiler with the following typedef: typedef struct foo { struct foo *next; int foo; } foo; It didn't like the multiple uses of "foo". Since I am porting someone else's large program and not writing one from scratch, the solution of "don't do it that way" doesn't work for me. You are within your rights. But don't try saying: `foo foo;' later on. Typedefs share the same name space as ordinary identifiers. Struxure tags are a completely different namespace. Each struxure has its own separate name space which is its own little universe, separate from other struxures and the global name space. Be sure you haven't used foo as a variable elsewhere, altho scope rules allow redefining within blox. My 4.2 compiler handles the above fragment okay. I would expect other serious ones to as well. Is there any statement in the ANSI proposed standard regarding this name space issue? I'd like to be able to coax my compiler vendor to fix it with a reasonable argument like conformance rather than saying "well, it works right with the 4.2 compiler." Tell him to read K&R and get the ANSI standard draft. Thanks in advance. Alan Crosswell Columbia University