March 22, 2003
more c++
ok continuing down the path of some weird syntax, this is just plain disturbing.
void(int*&);
A reference to a pointer,hrm. My mind is reeeeling with the awkward kludginess of this!
Why do we need to pass a reference to a pointer? if a pointer accesses the same object as a reference to that object would I'm not sure I see the need for this.
int i1;
int* i2=&i1;
int& i3=i1;
i1=11; or *i2=11; and i3=11;
All do the same thing right? I must be missing something here, big time, hrm.
Posted by
Andre Mermegas
at
March 22, 2003 03:36 PM
|
TrackBack
This is so you can assign a new object to the pointer. It is commonly used to pass back data from a function call where the return value from the function call is an int error code (0 if successful, -1 if error, etc).
This is more common in C. In C++, the function should return the object and throw an exception if there is an error.