VERSIONARY::BLOG






Recent Entries
firefox os x tricks
Let your Struts DispatchActions Fall through
thoughts on tapestry
#1
Netgear WGR614v2 stinks!
10 years? oh my
Riding through Chernobyl
Thoughts on Class Naming
One Tabbed Browser to Rule them All
The Fog of War


Monthly Entries
October 2004
August 2004
July 2004
June 2004
April 2004
March 2004
November 2003
October 2003
September 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003


Links n' Stuff

Wil Wheaton

JGuru
IntelliJ Tech Net
Oracle Tech Net
The Serverside
Javaranch Forums
JavaLobby

Coast to Coast
Terry Tate: My Hero



Categories
everything else
java
 


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
Comments

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.

Posted by: on March 27, 2003 05:15 PM
Post a comment



















October 2004
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31