[fpc-devel] "dynamic array of char" vs. "out array of char"

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Apr 27 23:43:48 CEST 2010


On 27 April 2010 23:21, Seth Grover <sethdgrover at gmail.com> wrote:
>
> Is this behavior correct? Can someone explain this to me? I thought
> that the only difference between "var" and "out" was whether or not
> the compiler warned you about uninitialized data.


Changing those two procedures to the following code shown below works
fine. I guess 'out' parameters are more strict with the types. Also,
your initial code for the second array should actually be inside the
DoItOut() procedure. All data contained in a variable passed to a
procedure with a 'out' parameter is discarded.

---------------------------------
type
 DynCharArray = array of char;

 procedure DoItVar(var yourArray : DynCharArray);
 begin
 end;

 procedure DoItOut(out yourArray : DynCharArray);
 begin
 end;
----------------------------------


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list