TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JOHN RICHARDSON
from: PETER GARNER
date: 1998-03-30 22:02:00
subject: passing by reference

JR> The idea of this is just to make the code look cleaner. AFAICS, it
JR> has no value except aesthetic.  
That is actually not true.  References have a very nice feature in
that one cannot accidentally have a null or an uninitialized reference. 
E.g.
int * pn;   //  An uninitialized ptr
int & rn;   //  A compiler error, references must be initialized.
Of course one can do something really stupid like
int * pn = 0;    //  An uninitialized ptr
int & rn = *pn; //  Back to square one
but at least C++ makes you have to do through an extra step
to have an accident!
JR> I should say that I have rejected C++ as offering me any benefit
JR> over standard C. 
Well, you are probably right.  If you do not see a benefit, there
probably is none to be had for you.  I never thought it was right
to force children to eat things they did not like either!  Left to
our own devices, we are very adept at finding what is best for
us!
Best of Luck
Peter
---
 þ KWQ/2 1.2i þ If you call me insane again, I'll eat your other eye.
---------------
* Origin: St. Louis Users Group (1:100/4)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.