Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hplsla!jima From: jima@hplsla.HP.COM (Jim Adcock) Newsgroups: comp.lang.c++ Subject: Re: Proposed extension ++@ , @++ Message-ID: <6590298@hplsla.HP.COM> Date: 12 Oct 89 21:10:35 GMT References: <4684@internal.Apple.COM> Organization: HP Lake Stevens, WA Lines: 32 // not to imply that the following is the "right" solution to pre vs post ++, // --and it doesn't work anyway, BUT, can someone explain to me why 2.0 accepts // postfix in the following, but not prefix??? ...And why g++ 1.35.x won't // accept either form??? extern "C" {int printf(char* p, ...);}; class cmpx { double re,im; // ... public: // ... cmpx(double r=0,double i=0):re(r),im(i){} cmpx& operator=(const cmpx& x){re=x.re; im=x.im; return *this;} operator double&(){return re;} }; main() { cmpx c,d; d=c; printf("%g\n",(double&)(d)); //d=++c; sorry, 2.0 won't accept this printf("%g\n",(double&)(d)); d=c++; printf("%g\n",(double&)(d)); d=c++; printf("%g\n",(double&)(d)); d=c; printf("%g\n",(double&)(d)); }