Re: pointer syntax
- From: "swansnow" <schultz@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: 23 Nov 2005 07:19:40 -0800
Maarten said:
>Yes. You have the "var" modifier on parameters exactly backwards. The
>default is call by value. Var makes a parameter call by reference.
Aha! OK, I think it makes sense now. :)
To summarize (let's see if I've got it right) --
In the context of general business programming (I'm not writing
drivers, or OSs, or anything complex):
* If I have an object, don't worry about var for general-purpose use,
and please don't make copies unless I know what I'm doing. Working with
objects is really working with references.
* Use var with objects, only if I intend to change the reference
(beware of orphaned memory!)
* If I have anything else, use var if I need changes to come back.
Avoid explicit pointers like the plague. (Again, unless I have some
special reason to need them, like strange API calls:) )
-Corinna
.
- Follow-Ups:
- Re: pointer syntax
- From: Maarten Wiltink
- Re: pointer syntax
- References:
- pointer syntax
- From: swansnow
- Re: pointer syntax
- From: Maarten Wiltink
- Re: pointer syntax
- From: swansnow
- Re: pointer syntax
- From: Maarten Wiltink
- pointer syntax
- Prev by Date: Re: Writing Binary Files with TFileStream
- Next by Date: Re: Using Delphi for mobile apps??
- Previous by thread: Re: pointer syntax
- Next by thread: Re: pointer syntax
- Index(es):
Relevant Pages
|