On (14 Aug 97) Daniel Jones wrote to Jerry Coffin...
JC> No need for pointers. You can use actual objects...
DJ> So you could! I was so focused on the pointers vs references issue I
DJ> failed to look at the broader picture.
Right.
DJ> Still, the ability to return a reference to an object rather than
DJ> creating and destroying multiple objects demonstrates my point that
DJ> references are more than "syntactic sugar."
Absolutely. As I said, performance suffers, probably dramatically,
depending on how expensive it is to create and destroy the objects.
However, it IS possible to do it.
JC> istream istream::operator(int x) {
JC> // body
JC> }
JC> it'd be able to modify its copy of `x' on the stack, but couldn't
JC> do _anything_ to the user's original object `x'.
DJ> Meaning that the programmer would have to pass a pointer rather than
DJ> the object itself - something like:
DJ> cin << &Number;
DJ> vice
DJ> cin << Number;
Umm..maybe:
cin >> &Number;
versus:
cin >> Number;
the direction of the "arrow" _does_ make a noticeable difference...
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|