Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!news.funet.fi!tukki.jyu.fi!sakkinen From: sakkinen@tukki.jyu.fi (Markku Sakkinen) Newsgroups: comp.object Subject: Re: The Emperor Strikes Back Message-ID: <1991Mar8.061042.5578@tukki.jyu.fi> Date: 8 Mar 91 06:10:42 GMT References: <1991Mar5.225458.4408@m.cs.uiuc.edu> Reply-To: sakkinen@jytko.jyu.fi (Markku Sakkinen) Organization: University of Jyvaskyla, Finland Lines: 56 In article pcg@cs.aber.ac.uk (Piercarlo Antonio Grandi) writes: >On 5 Mar 91 22:54:58 GMT, johnson@cs.uiuc.EDU (Ralph Johnson) said: > >johnson> It appears that Piercarlo and I use different terminology. Perhaps >johnson> this explains our inability to agree. > > [a lot deleted] > >I know abpout the output of cfront, and I can tell you that your >impression of it is inaccurate. [...] > ... > >I will give another example, in C++: It would help to make people believe that you really know much about C++ if your examples were approximately correct. >Suppose we have the following: > > struct Complex { float re, im; }; > >[1] Complex operator +(const Complex &a,&b) > { return Complex(a.re+b.re,a.im+b.im; } That one parenthesis is missing does not mislead anybody. However, you must either declare a constructor in the obvious way within the 'struct' declaration or use braces in the 'return' statement to make a structure initialiser. Let's suppose the former alternative, i.e. Complex (float x, y) {re = x; im = y;} >compared with > > struct Complex { > float re,im; > >[2] Complex operator +(const Complex &b) const > { return re+b.re,im+b.im}; > }; The compiler would complaining that you are returning a float instead of Complex. That's the stupid sequencing operator of C and C++. You must actually write: { return Complex (re+b.re, im+b.im); } assuming the same constructor as above. A similar correction is needed for example [3]. > [rest deleted] Markku Sakkinen Department of Computer Science and Information Systems University of Jyvaskyla (a's with umlauts) PL 35 SF-40351 Jyvaskyla (umlauts again) Finland SAKKINEN@FINJYU.bitnet (alternative network address)