home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
- From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
- Subject: Re: the 'standard' complex class
- Message-ID: <9224017.22289@mulga.cs.mu.OZ.AU>
- Sender: news@cs.mu.OZ.AU
- Organization: Computer Science, University of Melbourne, Australia
- References: <MCGRANT.92Aug26143400@rascals.stanford.edu> <BtMGyz.52A@me.utoronto.ca> <MCGRANT.92Aug26232210@rascals.stanford.edu>
- Date: Thu, 27 Aug 1992 07:21:24 GMT
- Lines: 31
-
- mcgrant@rascals.stanford.edu (Michael C. Grant) writes:
-
- > Inlining access functions might give
- > the efficiency you need.
- >
- >Nope, unfortunately that's not true---the way AT&T set things up, that is.
- >Their functions pass by value and not by reference, and from examining the
- >assembly I can tell you that the efficiency isn't there, even for the
- >inlined functions. Of course, when I manually changed appropriate functions
- >to accept 'const complex&' instead of 'complex', that improved things a
- >lot, but not quite to the point that I'm happy with keeping .re and .im
- >private.
- >
- >Michael C. Grant
-
- Sounds like you should be blaming your compiler's poor optimization,
- not the fact that .re and .im are private. If you have inline set_real()
- and set_imag() methods then you should get exactly the same code using
- them as using the private members.
-
- Maybe you could post a specific example of some code that would be more
- efficient if you could use the private members.
-
- Ah... I see from looking at <complex.h> that set_real() and set_imag()
- methods have NOT been provided by AT&T.
-
- --
- Fergus Henderson fjh@munta.cs.mu.OZ.AU
- This .signature virus is a self-referential statement that is true - but
- you will only be able to consistently believe it if you copy it to your own
- .signature file!
-