home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!slsvaat!slsvitt!dcb
- From: dcb@slsvitt (David Binderman 3841)
- Subject: ARM code don't work
- Message-ID: <1992Sep14.181108.8639@us-es.sel.de>
- Summary: cfront 3.1 ready yet ?
- Sender: news@us-es.sel.de
- Organization: SEL-Alcatel LTS Dept. US/ES
- X-Newsreader: Tin 1.1 PL4
- Date: Mon, 14 Sep 92 18:11:08 GMT
- Lines: 70
-
- Hello there,
-
- I tried the code from pages 292 and 293 of the ARM on various C++ compilers.
-
- I found that cfront 2.1, cfront 3.0, GNU 1.39, GNU 222 all got the same answer.
-
- Unfortunately, not the same answer as the ARM.
-
- Can anyone tell me which is right ?
-
- results are
-
- B ctor
- A ctor
- C ctor
- D ctor
- E ctor
-
- ARM claims
-
- A ctor
- B ctor
- C ctor
- D ctor
- E ctor
-
- Code follows
-
- ---------------------- cut here --------------------------------------
- extern "C" {
- int printf( const char *, ...);
- };
-
- class A {
- public:
- A() { printf( "A ctor\n"); };
- };
-
- class B {
- public:
- B() { printf( "B ctor\n"); };
- };
-
- class C : public virtual A, public virtual B {
- public:
- C() { printf( "C ctor\n"); };
- };
-
- class D : public virtual B, public virtual A {
- public:
- D() { printf( "D ctor\n"); };
- };
-
- class E : public C, public D {
- public:
- E() { printf( "E ctor\n"); };
- };
-
- int main() {
- E e;
- return 0;
- }
-
- -------------------- cut here ----------------------------------------
-
- Regards
- --
- David C Binderman Dept US/ESI, Bau 60, SEL-Alcatel AG, Lorenz Strasse 10,
- D-7000 Stuttgart 40, Germany dcb@us-es.sel.de +49 711 821 3841
- If you lie to the compiler, it will gets its revenge
-