home *** CD-ROM | disk | FTP | other *** search
- 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
- From: mg@elan (Michael Golan)
- Newsgroups: comp.lang.c++
- Subject: Re: Which compilers have templates/exceptions?
- Message-ID: <mg.721134507@elan>
- Date: 7 Nov 92 11:08:27 GMT
- References: <1992Nov2.115817.1@happy.colorado.edu> <1992Nov3.002214.18715@ninja.zso.dec.com>
- Sender: news@csservices.Princeton.EDU (USENET News System)
- Organization: Princeton University, Dept. of Computer Science
- Lines: 60
-
- newkerk@dirac.zso.dec.com (Oscar Newkerk) writes:
-
- >>
- >> Templates Exceptions
- >> Borland V3.1 partial (no friend classes) none
- >> Microsft CV7 none macros (poor)
- >> Zortech V? none? none?
- >>
- >> Thanks,
- >> Sieg
- >>
-
- >DEC C++ Yes Yes
-
- cxx was just installed here. I don't know which version, of course,
- since cxx -V nor -v nor the man page would tell. It does "support"
- templates, but! (It is symlink to cxx2.1 so that might be the ver num)
-
- The first thing I tried (honest!) was:
-
- #include <stdio.h>
- class X {
- int x ;
- public:
- X operator+(X b) { return x+b.x ; }
- void print() { printf("%d\n",x); }
- X(const int n=0) :x(n) {}
- X(const X& v) { x=v.x ; }
- };
- main()
- {
- X u(3),v(2),w ;
- u.print(); v.print();
- w=u+v ;
- w.print();
- }
-
-
- Then, I compiled with -O -S and took a look at the output.
- It *runs correctly*, but the compiler's sense of the required frame size
- and the use of registers and temporaries shows either serious bugs or a
- really (really) bad compiler.
-
- The 2nd program I tried (ok, I narrowed it down to this :-):
-
- class S { public: S(const char *x) {} };
-
- class T { public:
- operator const char*() const{}
- void ok(const T& s) { S tmp(s); } // fine
-
- class subT { public:
- void bug(const T& s) { S tmp(s); } // wont compile, DEC C++ bug:`
- //: error: In this declaration, the argument list "(s)" matches no "S::S".
- };
- };
-
- Then I gave up and went back to C :-(
- Michael Golan
- mg@princeton.edu
-