On Fri, Jul 20, 2007 at 05:00:33PM -0500, Mike Caron wrote:
> On 7/20/07, James Paige <[EMAIL PROTECTED]> wrote:
> > Hey, Mike. I noticed that DeSerHeroDef and SerHeroDef expect a herodef
> > ptr rather than just taking a herodef as an argument. Why is this? If
> > the herodef object was passed by value (copied) I would understand the
> > need for using pointers, but I was under the impression that objects are
> > passed by reference by default. Was I mistaken about that? Also, what
> > advantage would passing a pointer have over explicitly passing byref?
> 
> Well, I never liked Byref to begin with. It's easy to forget that a
> variable is not yours exclusively, and then you get bugs. Further, if
> you're not expecting a function to modify a variable, and they do,
> then you can't trust the value of the variable.

Huh. I guess that never bothered me because I am used to working in 
languages that pass everything byref by default

> By making it a pointer, you emphasize that it's not your variable,
> and, you remind the caller that it needs direct access to the
> variable.

Interesting. That is a lot like my rational for wanting variable 
suffixes on strings.

---
James Paige
_______________________________________________
ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to