I... don't think that's the purpose of pointers.

On 7/20/07, Mike Caron <[EMAIL PROTECTED]> 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.

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.

--
Mike Caron
Tale of the Cave
http://taleofthecave.com
_______________________________________________
ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

_______________________________________________
ohrrpgce mailing list
ohrrpgce@lists.motherhamster.org
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org

Reply via email to