home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11218 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  1.7 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!nuscc!solomon.technet.sg!arthur
  2. From: arthur@solomon.technet.sg (Arthur Sombrito)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: scope of typedef declaration within a class declaration?
  5. Message-ID: <1992Jul21.105613.14776@nuscc.nus.sg>
  6. Date: 21 Jul 92 10:56:13 GMT
  7. References: <130538@lll-winken.LLNL.GOV>
  8. Sender: usenet@nuscc.nus.sg
  9. Organization: National University of Singapore
  10. Lines: 44
  11.  
  12. casey@gauss.llnl.gov (Casey Leedom) writes:
  13. :   I'm working with SGI's C++ 2.1.1 which is based on AT&T's cfront 2.0.
  14. : SGI's C++ promotes typedef declarations within class declarations to the
  15. : global scope.  Moreover, it doesn't even let me access the typedef name
  16. : via class-name::typedef-name.  This seems to be contrary to the C++ 2.0
  17. : specification.  Section 10.4, Summary of Scope Rules, in the AT&T C++
  18. : Language System manual even specifies:
  19. :     ``... These rules apply uniformly for all names (including
  20. :       typedef-names (sec.7.1.3) and class-names (sec.9.1)) wherever
  21. :       the grammar allows such names in the context discussed by a
  22. :       particular rule. ...''
  23. :   Here's an example of what I'm trying to do:
  24. :    1    class foo {
  25. :    2        public:
  26. :    3        typedef int bar;
  27. :    4        bar x;
  28. :    5    };
  29. :    6    
  30. :    7    main()
  31. :    8    {
  32. :    9        foo::bar i;
  33. :   10        foo f;
  34. :   11    
  35. :   12        i = 1;
  36. :   13        f.x = i;
  37. :   14    }
  38. : SGI's C++ compiler complains about line 9 (getting confused about missing
  39. : semicolons, etc.) and the only way I can make it work is if I change line
  40. : 9 to read ``bar i;''
  41. :   Am I completely misconstruing the meaning of the scoping rules with
  42. : regard to typedefs???
  43. : Casey
  44.  
  45. You got it right. It's just one of the specifications that cfront does not
  46. adhere to.
  47.  
  48. Art
  49.