Topic: Q: Are member-enums in a global namespace?
Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/11/28 Raw View
In article 100000@fcggsg06.tu-graz.ac.at, Martin Kammerhofer <mkamm@icg.tu-graz.ac.at> writes:
>Trying to compile some Open Inventor stuff on a SGI with a
>cfront 2.1 derived compiler I ran into trouble.
>SGI's Open Inventor header files frequently define enums as members and
>use the SAME name.
>cfront complains about that.
>Any comments about what behaviour (member enums in a per class namespace
>versus in a global namespace) is standard would be appreciated.
I'm not sure I understand your question, but I think you are asking about
a situation like this:
class A { public: enum E { off, on }; };
class B { public: enum E { off, flash, on }; };
The old (pre-1991) rule was that types declared in a class were exported,
as in C. The above example would have been invalid under old rules.
The more recent rule is that types can be nested in classes. That is the
rule in the ARM and is still the rule, and my example above (modulo any
typos) is valid.
Cfront 2.1 was a transition compiler, and exported types in some
circumstances and nested them in others. The idea was to allow then-
existing code to continue to work, while allowing types to be nested
if you jumped through the right hoops.
Because of the many significant language changes since Cfront 2.1, I
recommend you replace yours with a modern compiler.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Author: Martin Kammerhofer <mkamm@icg.tu-graz.ac.at>
Date: 1995/11/28 Raw View
Trying to compile some Open Inventor stuff on a SGI with a
cfront 2.1 derived compiler I ran into trouble.
SGI's Open Inventor header files frequently define enums as members and
use the SAME name.
cfront complains about that.
Any comments about what behaviour (member enums in a per class namespace
versus in a global namespace) is standard would be appreciated.
=====================================================================
= Martin Kammerhofer <mkamm@icg.tu-graz.ac.at> =
= Institute for Computer Graphics - Graz University of Technology =
= Muenzgrabenstrasse 11, A-8010 Graz, Austria =
= Tel.: (43) (316) 84 17 66 - 13 Fax: (43) (316) 84 63 04 =
=====================================================================
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]