TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MICHAEL MCGAVIN
from: JOHN RICHARDSON
date: 1998-03-24 08:40:00
subject: passing by reference

Hi Michael,
I should say that I have rejected C++ as offering me any benefit over 
standard C.
 > Is it just me who's having a hell of a time thinking this through or is
 > this some sort of exception in the design of the language whereby a '&'
 > character can be used to get the compiler to automagically work out all
 > the pointer stuff?  :-]
The idea of this is just to make the code look cleaner. AFAICS, it has no 
value except aesthetic.
eg.
int     funca( int &x)
{
    x = 2;
    return(0);
}
is exactly equivalent to:
int     funcb( int *x)
{
    *x = 2;
    return(0);
}
It also makes calling the function look nicer too:
    funca( var);
    funcb( &var);
John.
--- JetMail 0.99beta23
---------------
* Origin: The Dysfunctional Refrigerator (fidonet 2:2502/60)

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™.