
Posted:
Apr 23, 2004 @ 7:55pm
by kornalius
ok thanks.
Regards,
Kornalius

Posted:
Apr 26, 2004 @ 12:40pm
by Dan East
It would be:
DOUBLE d;
DOUBLE &d2=d; //not =&d;
I guess that would work, but it is a terrible programming practice. I can just imagine the convoluted mess that would result, since it would not be clear which vars are "real" and which are references. The advantage of a pointer is that it really is a different type.
This is on a completely different note, but I feel it is bad practice to declare like this:
DOUBLE& d2;
instead of this:
DOUBLE &d2;
We discussed this a couple years ago. The former gives the appearance that you are using the type DOUBLE&, when the ampersand is really a modifier for a single variable.
Here's where that syntax is problematic:
DOUBLE& d1, d2;
That gives the appearance that both d1 and d2 are "DOUBLE &", whereas only the d1 is a reference, not d2.
DOUBLE &d1, d2;
That makes it perfectly clear what is being declared.
Dan East