Topic: AT&T C++ 2.0 Efficacious?


Author: timh@.mentorg.com (Tim Harvey @ APD x1381)
Date: 18 Jan 91 22:41:31 GMT
Raw View
Eric Valette (Article 496) thought that AT&T C++ 2.0 might be efficacious.
I don't think so in this case.

I ran C++/cfront version 2.0 release 2c on his example, and as you can
see below, the C output looks fine.

Eric, did you take your question to where ever you got your cfront port?
It looks like you posted gnu.g++.help.  Are you using gnu g++?


//  C++ source code
class example {
private:
  int a ;
public:
  int  getVal()          { return a ; }
  void setVal( int val ) { a = val ; }
};

example glob ;

void f() {
  example loc;
  int     a = 1 ;
  int     b = 2 ;
  int     resu ;

  loc.setVal(1) ;
  resu = loc.getVal() ;

  glob.setVal(1) ;
  resu = glob.getVal() ;
}




Compiled on an Apollo 4500.  Generated C code follows.
C++/cfront version 2.0 release 2c [apollo.mc68000.sys5.]
"t.c", line 13: warning:  loc used but not set


char  *__vec_new() ;
char  __vec_delete() ;

typedef int  (*__vptp)() ;

struct __mptr {
    short  d ;
    short  i ;
    __vptp f ;
};

struct example {
    int a__7example ;
};

extern struct __mptr *__ptbl_vec__t_c_[] ;

static int getVal__7exampleFv( __0this )
struct example *__0this ;
{
  return __0this->a__7example ;
}

static char setVal__7exampleFi( __0this, __0val )
struct example *__0this ;
int __0val ;
{
  __0this->a__7example = __0val ;
}

struct example glob = { 0 } ;

char f__Fv() {
  struct example __1loc ;
         int     __1a ;
         int     __1b ;
         int     __1resu ;

  __1a = 1 ;
  __1b = 2 ;

  setVal__7exampleFi( &__1loc, 1 ) ;
  __1resu = getVal__7exampleFv( &__1loc ) ;

  setVal__7exampleFi( &glob, 1 ) ;
  __1resu = getVal__7exampleFv( &glob ) ;
}