Thread View: comp.std.c++
2 messages
2 total messages
Started by Martin Kammerhofer
Tue, 28 Nov 1995 13:09
Q: Are member-enums in a global namespace?
Author: Martin Kammerhofer
Date: Tue, 28 Nov 1995 13:09
Date: Tue, 28 Nov 1995 13:09
18 lines
1546 bytes
1546 bytes
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. ]
Re: Q: Are member-enums in a global namespace?
Author: Steve Clamage
Date: Tue, 28 Nov 1995 17:39
Date: Tue, 28 Nov 1995 17:39
40 lines
2112 bytes
2112 bytes
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. ]
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