home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 15915 < prev    next >
Encoding:
Text File  |  1992-11-08  |  2.0 KB  |  72 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!stanford.edu!rutgers!princeton!csservices!elan!mg
  2. From: mg@elan (Michael Golan)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Which compilers have templates/exceptions?
  5. Message-ID: <mg.721134507@elan>
  6. Date: 7 Nov 92 11:08:27 GMT
  7. References: <1992Nov2.115817.1@happy.colorado.edu> <1992Nov3.002214.18715@ninja.zso.dec.com>
  8. Sender: news@csservices.Princeton.EDU (USENET News System)
  9. Organization: Princeton University, Dept. of Computer Science
  10. Lines: 60
  11.  
  12. newkerk@dirac.zso.dec.com (Oscar Newkerk) writes:
  13.  
  14. >> 
  15. >>             Templates                Exceptions
  16. >> Borland V3.1        partial (no friend classes)             none
  17. >> Microsft CV7        none                    macros (poor)
  18. >> Zortech V?        none?                    none?
  19. >> 
  20. >>             Thanks,
  21. >>                 Sieg
  22. >> 
  23.  
  24. >DEC C++            Yes                    Yes
  25.  
  26. cxx was just installed here. I don't know which version, of course,
  27. since cxx -V nor -v nor the man page would tell. It does "support"
  28. templates, but!    (It is symlink to cxx2.1 so that might be the ver num)
  29.  
  30. The first thing I tried (honest!) was:
  31.  
  32. #include <stdio.h>
  33. class X {
  34.     int x ;
  35. public:
  36.     X operator+(X b) { return x+b.x ; }
  37.     void print() { printf("%d\n",x); }
  38.     X(const int n=0) :x(n) {} 
  39.     X(const X& v) { x=v.x ; }
  40. };
  41. main()
  42. {
  43.   X u(3),v(2),w ;
  44.   u.print();  v.print();
  45.   w=u+v ;
  46.   w.print();
  47. }
  48.  
  49.  
  50. Then, I compiled with -O -S and took a look at the output. 
  51. It *runs correctly*, but the compiler's sense of the required frame size
  52. and the use of registers and temporaries shows either serious bugs or a
  53. really (really) bad compiler.
  54.  
  55. The 2nd program I tried (ok, I narrowed it down to this :-):
  56.  
  57. class S { public: S(const char *x) {} };
  58.  
  59. class T { public:
  60.     operator const char*() const{}
  61.     void ok(const T& s) { S tmp(s); }        // fine
  62.  
  63.     class subT { public:
  64.         void bug(const T& s) { S tmp(s); }    // wont compile, DEC C++ bug:`
  65.   //: error: In this declaration, the argument list "(s)" matches no "S::S".
  66.     };
  67. };
  68.  
  69. Then I gave up and went back to C :-(
  70.   Michael Golan
  71.   mg@princeton.edu
  72.