Page 1 of 1

[Implemented] CountArray() ?

Posted: Sat Jul 08, 2006 9:59 am
by Flype
Since we can pass an Array (and LinkedList) to a procedure
it might be useful to be able to retrieve the number of elements of the array inside the procedure.

it could be done with :

Code: Select all

Macro CountArray(array) 
  ( PeekL( @array-8 ) ) 
EndMacro
but it's not 'future proof', so a builtin commands would be nice, no ?


example :

Code: Select all

Macro CountArray(array) 
  ( PeekL( @array-8 ) ) 
EndMacro

Procedure MyProc(UserArray.l(1))
  
  Protected nElement.l = CountArray(UserArray())
  
  Debug nElement
  
EndProcedure

Dim test.l(123)

MyProc(test())