O/H Rob Kennedy έγραψε:
> 
> 
> Theodoros Bebekis wrote:
>  > An recent coding error revealed that it is possible to pass a bounded 
> array
>  > to a dynamic array. Here is how.
>  >
>  >
>  > type
>  > TIntArray = array of integer;
>  > PIntArray = ^TIntArray;
>  >
>  >
>  > (* helper, it displays the ref counter of a dynamic array *)
>  > procedure DisplayRefCount(A: TIntArray);
>  > var
>  > P : Pointer;
>  > begin
>  > P := A;
>  >
>  > P := Pointer(Integer(P) - 4);
>  > ShowMessage(IntToStr(PInteger(P)^));
> 
> That displays the array's length, not its reference count. Be careful
> about passing empty arrays!

You're right.
My mistake. It's a left over from a bigger function though.
I had two P := Pointer(Integer(P) - 4); in turn.
Just correct it to either
    P := Pointer(Integer(P) - 8);
or
   DisplayLength()



-- 
Regards
Theo

------------------------
Theo Bebekis
Thessaloniki, Greece
------------------------
Greek_Delphi_Prog : a Delphi Programming mailing list in Greek at
    http://groups.yahoo.com/group/Greek_Delphi_Prog

CSharpDotNetGreek : A C# and .Net mailing list in Greek language at
    http://groups.yahoo.com/group/CSharpDotNetGreek

atla_custom : a Unisoft Atlantis Customization mailing list at
    http://groups.yahoo.com/group/atla_custom
------------------------

------------------------------------

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [email protected]! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/delphi-en/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to