Board index » delphi » The "out" parameter declaration

The "out" parameter declaration

Hi there,

After snooping around in the Delphi3 source for a while, especially in
the OLE2 section, I noticed a parameter declaration I have never seen
before.  It went like so:

  function( out parameter: OleVariant );

Upon checking the (limited) info in the on-line help, I did notice that
it is thrown into the same category as the const and var declarations.

Does anybody know what this does?  How different is this from the var
declaration?

Thanks,
joe

 

Re:The "out" parameter declaration


On Wed, 14 May 1997 09:57:23 -0400, Joseph Good

Quote
<joseph_d._g...@dadeint.com> wrote:
>After snooping around in the Delphi3 source for a while, especially in
>the OLE2 section, I noticed a parameter declaration I have never seen
>before.  It went like so:

>  function( out parameter: OleVariant );

>Upon checking the (limited) info in the on-line help, I did notice that
>it is thrown into the same category as the const and var declarations.

>Does anybody know what this does?  How different is this from the var
>declaration?

The online help file for "out parameters" explains them clearly.
An OUT parameter is similar to a VAR parameter, but Delphi
automatically manages reference counts for COM interfaces. In case of
error, Delphi automatically sets the OUT parameter to nil.

--
Ray Lischner            
Author of Secrets of Delphi 2 (http://www.tempest-sw.com/secrets/)

Re:The "out" parameter declaration


Quote
Joseph Good wrote:

> Hi there,

> After snooping around in the Delphi3 source for a while, especially in
> the OLE2 section, I noticed a parameter declaration I have never seen
> before.  It went like so:

>   function( out parameter: OleVariant );

> Upon checking the (limited) info in the on-line help, I did notice that
> it is thrown into the same category as the const and var declarations.

> Does anybody know what this does?  How different is this from the var
> declaration?

        It's possible to look up "out" in online help - that's what I
did when I noticed it somewhere. Of course it didn't _quite_ follow what
it said an out parameter was, but I followed the part that said "It is
recommended that you only use out parameters with COM methods since
variable parameters are more efficient ", which was all I needed to
know right then.

--
David Ullrich

?his ?s ?avid ?llrich's ?ig ?ile
(Someone undeleted it for me...)

Other Threads