[comp.lang.c++] Half implementation of inline recursion.

hughes@ns.network.com (Jim Hughes x1676) (06/21/89)

I seem to have a bit of a problem with Sun3 and Sun4 C++ 1.2 (although
it seems to have nothing particular to the Sun architecture).  I ask if
this is fixed in 2.0. I realize that recursion in an inline function is
typically not desirable except in the case where the recursion is not the
normal case.

The warnings also seem to be a bit confused.

I also ask if variable arguments on Sun4s have been resolved in 2.0.

I first cat the input file, then CC it, and cat the ..c file.

20 % cat test.c

class a { public:
  void x(int a);
  a() {}
};

inline void a.x(int a)  {
  if (a) x(a-1);
}

main() {
  a a1;
  a1.x(5);
}

21 % CC +i test.c

CC  test.c:
"test.c", line 4: warning: no value returned from a::a()
"test.c", line 13: warning:  a1 used but not set
cc    test..c -lC
"test..c", line 11: redeclaration of _a_x
mv: test..o: Cannot access: No such file or directory

22 % cat test..c

/* <<cfront 1.2.1 2/16/87>> */
/* < test.c */
char *_new(); char _delete(); char *_vec_new(); char _vec_delete();

struct a {      /* sizeof a == 2 */
char _dummy; };

char _a_x ();

static char _a_x ();


int main (){ _main(); { 
struct a _au1_a1 ;
( (_a_x ( (& _au1_a1 ), 5 - 1 ) )) ;
}
};

static char _a_x (_au0_this , _au0_a )
struct a *_au0_this ;

int _au0_a ;

{ 
if (_au0_a )_a_x ( _au0_this , _au0_a - 1 ) ;
}

/* the end */
23 % 

Thanks

Jim Hughes
Hughes@network.com