home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!rutgers!modus!polluce!siap.sublink.org!aleardo
- From: morgaine@siap.sublink.org (Nadia Pitacco (Morgaine))
- Newsgroups: comp.lang.c++
- Subject: Name space of enumeration lists identifiers
- Keywords: enumeration name space
- Message-ID: <aleardo.715356862@siap.sublink.org>
- Date: 1 Sep 92 14:14:22 GMT
- Sender: news@siap.sublink.org
- Reply-To: morgaine@siap.sublink.org
- Organization: SIAP Sistemi S.p.A.
- Lines: 45
- Nntp-Posting-Host: gea
-
-
- I have the following source file:
-
- #include <pwd.h>
- enum my_enum {comment, some_other_value};
-
- main () {
- /* code omitted */
- exit (0);
- }
-
- pwd.h includes the definition of the following struct:
-
- struct comment {
- char *c_dept;
- char *c_name;
- char *c_acct;
- char *c_bin;
- };
-
- Compilation under ObjectWorks, which includes a modified version of At&T cfront, produces the following results:
-
- CC /tmp/main.c:
- "/tmp/main.c", line 2: error: syntax error
- "/tmp/main.c", line 2: error: syntax error
- "/tmp/main.c", line 2: error: bad declaration of some_other_value --
- did you forget a ';'?
- 3 errors
-
- While both Liant C++ compiler and g++ rev.1.39 (with option -Wall) do not
- produce any error or warning message.
-
- According to "The Annotated C++ Reference Manual" (p. 27)
- "A name s can be declared as a type and as a non-type in a single scope."
- and I though that identifiers in an enumerator list belonged to the same
- name space of constants.
-
- Who is wrong, and why?
- Nadia Pitacco
- --
- ------------------------------------------------------------
- - Nadia Pitacco SIAP Sistemi S.p.A. -
- - via Mercantesse 3 - 20021 Baranzate Milano ITALY -
- - E-Mail: morgaine@siap.sublink.org -
-