TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MICHAEL MCGAVIN
from: JONATHAN DE BOYNE POLLARD
date: 1998-03-26 09:44:00
subject: passing by reference

 MM> Is it just me who's having a hell of a time thinking this through or
 MM> is this some sort of exception in the design of the language whereby
 MM> a '&' character can be used to get the compiler to automagically work
 MM> out all the pointer stuff?  :-]
Believe it or not, it's the latter.  Pass-by-reference arguments to functions 
are implemented in most, if not all, compilers by passing pointers to the 
relevant variables behind the scenes, and translating
        var1 = 1 ;
in the body of the function into, effectively,
        *pointer_to_referred_var1 = 1 ;
where `pointer_to_referred_var1' is what was actually passed, under the 
covers, as the reference parameter.
 ¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)

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