TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARIN MCBRIDE
from: MICHAEL MCGAVIN
date: 1998-03-28 13:07:00
subject: passing by reference

Hi Darin,
Note to everyone:  While I'm here I'd like to thank everyone who helped out 
with my query.  All info has been read and appreciated.  :-)  (I don't want 
to clutter up the echo and I'd netmail everyone but my experience with 
inter-zone netmail is that it never seems to work the way I want it to.  )
Darin McBride was saying something to Michael McGavin about "passing by 
reference":
 MM>> void afunction(int *var1)
 MM>> {
 MM>> *var1=546;
 MM>> }
 MM>> void main()
 MM>> {
 MM>> int k;
 MM>> afunction(&k);
 MM>> }
 DM> This isn't passing by reference, per se.  It's passing a pointer to
 DM> an object.  The difference is, as you say, "manual."  Reference
 DM> passing in every language is an automatic thing handled by the
 DM> compiler.  For example, many people coming from a pascal background
 DM> would recognize:
Thanks for helping to clear this up.  It's been a great help.  :-)
One thing that still holds my interest is how the compiler handles it 
automatically.  Is the code generated for passing by reference going to work 
out the same as passing a pointer to an object and subsequently dereferencing 
that pointer?
All the best.
Mike.                                   email: zog@sans.vuw.ac.nz
--- GoldEd 2.50 UNREG
---------------
* Origin: DARK SKIES Astronomy -- Wgtn, NZ. +64-4-235-6887 (3:771/1560.201)

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