TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: John Beckett
from: Antti Kurenniemi
date: 2004-11-09 16:33:54
subject: Re: C++

From: "Antti Kurenniemi" 

"John Beckett"  wrote
in message news:419087c1.2407381{at}216.144.1.254...
> In case Geo reads this literally, I think it should be clarified.
> Consider:
>
> void func()
> {
>    int i;
>    Date d;
>    // ... do stuff ...
> }
>
> It's not true that the above creates a pointer to the Date.

Thanks for clarifying - I knew I said something very wrong. But (I'm just
asking this and not arguing, because it's been ages since I did any
"real" C++): when you pass an int as a variable to a function,
you are actually passing a variable by value, thus creating a new variable
in the function that was called, and then you can change the value in that
function without affecting the original one, right (nevermind passing
actual pointers for now)? But when you pass that "d" to a
function, you're passing a "pointer" (reference? handle? what do
you call it now?) to that object and *not* creating another object in the
scope of the function that was called, right? Is it even possible to
actually pass an object by value to a function? This is basically what I
meant by "d" being more of a pointer than a variable, it's just
hidden by the compiler / language.

Or did I just confuse poor ol' schoolboy Geo more?


Antti Kurenniemi

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

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