home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 12985 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.2 KB  |  48 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: enum problem.
  5. Message-ID: <1992Aug27.184237.10833@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <3532@unisql.UUCP>
  8. Date: Thu, 27 Aug 1992 18:42:37 GMT
  9. Lines: 37
  10.  
  11. nandraj@unisql.UUCP (Nandraj Arni) writes:
  12.  
  13.  
  14. >   I have this problem. Two versions of GNU's compilers are
  15. >acting in different ways. Which is correct?
  16.  
  17.  
  18. >class EnumTest {
  19. >public:
  20. >   enum varType { Apple, Orange};
  21. >   varType get_fn();
  22. >}
  23.  
  24.  
  25. >varType EnumTest::get_fn() { ... }
  26.  
  27. >EnumTest::varType EnumTest::get_fn() { ... }
  28.  
  29. >  Neither compilers like the other definition.
  30.  
  31.  
  32. This is an area of language change, and the two compilers implement
  33. different versions of the language.
  34.  
  35. It used to be that the name of a type declared in a class was
  36. exported to the outer scope.  Now the type name remains local to the
  37. scope, and the name must be qualified when used outside that scope.
  38.  
  39. If you need to use compilers with different rules, you will
  40. probably have to use some conditional code to keep them both happy.
  41. This gets rather ugly.
  42.  
  43. A better solution might be to upgrade the earlier compiler.
  44. -- 
  45.  
  46. Steve Clamage, TauMetric Corp, steve@taumet.com
  47. Vice Chair, ANSI C++ Committee, X3J16
  48.