home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!laphroaig!cflatter
- From: cflatter@nrao.edu (Chris Flatters)
- Subject: Re: Name-scope semantic differences between 2.
- Message-ID: <1992Dec11.213637.26641@nrao.edu>
- Sender: news@nrao.edu
- Reply-To: cflatter@nrao.edu
- Organization: NRAO
- References: <1992Dec11.181927.7768@delfin.com>
- Date: Fri, 11 Dec 1992 21:36:37 GMT
- Lines: 45
-
- In article 7768@delfin.com, mr@delfin.com (Mark Rosenberg) writes:
- >How are CFRONT 2.1 name-scoping semantics different from CFRONT 3.0
- >name-scoping semantics? We are developing a product that needs to be
- >supported on several different platforms (currently RS-6000 and Sparc).
- >This product relies upon Objectstore. According to their support
- >people, their compiler has templates but 2.1 name-scope semantics.
- >
- >Apparently 2.1 name-scope semantics are not a subset of 3.0 name-scope
- >semantics. What are the implications of these semantic differences?
- >What should one do or not do to maximize compatibility?
-
- Suppose that you declare a nested class as follows.
-
- class foo
- {
- ...
- class bar
- {
- ...
- }
- }
-
- According to the ARM the scope of bar is limited to class foo. cfront
- 3.0 and g++ 2.x conform to this.
-
- cfront 2.1 gives bar global scope. To clarify this the definition of
- a constructor for bar would look like this according to the ARM
-
- foo::bar::bar() { ... }
-
- but would look like this for cfront 2.1
-
- bar::bar() {...}
-
- To maximise portability between cfront 2.1 and other C++ compilers you can either
-
- 1 - avoid using nested classes or
-
- 2 - ensure that class names are unique at the innermost scope level (ie.
- make sure that you don't have two or more nested classes with the same
- name) and use the preprocessor to fix up member function definitions.
-
- Chris Flatters
- cflatter@nrao.edu
-
-