Re: array size



The only problem with getting the pointer to a SafeArray descriptor generically
through dereferencing the array pointer out of the Varaint, as in the method shown
in your link, is that passing an uninitialized array of objects or UDTs will cause the
array to be initialized to a zero element array. So the example code will always
return 1 for the number of dimensions of an uninitialized array of objects or UDTs.


"Norm Cook" <normcookNOSPAM@xxxxxxxxxxxx> wrote in message news:%23MCydNPbFHA.2756@xxxxxxxxxxxxxxxxxxxxxxx
> 1. What's wrong with error checking or keeping a boolean flag?
>
> 2. You missed the link in Mike's google page:
> http://vbnet.mvps.org/index.html?code/helpers/getarraydims.htm
> This code not only determines whether or not the array is initialized
> but also gives the number of dimensions. Note, however, that
> even that code has to do an If call,
> If address <> 0 Then
> which is just another form of error checking.
>
> 3. How about
> Dim A() as whatever
> ReDim A(0)
> Now it is dynamic & you can resize it, check its bounds, etc
>
> "sali" <sali@xxxxxxxxxxx> wrote in message
> news:O0F6KZObFHA.724@xxxxxxxxxxxxxxxxxxxxxxx
>> "Mike D Sutton" <EDais@xxxxxxxx> wrote in message
>> news:ufUpEXNbFHA.1456@xxxxxxxxxxxxxxxxxxxxxxx
>> > [Ignore previous post..]
>> >
>> >> "dim arr()"
>> >> to have dynamic aray, and after sometimes
>> >> "redim arr(some_size)"
>> >> but then, to check the current size with
>> >> "ubound(arr)"
>> >> gives error if arr is not yet "redimed"
>> >>
>> >> is it possible to check for empty array [no one element] *without*
> having
>> >> to
>> >> catch errors?
>> >> [and without auxilary variable to hold "not-yet-redim"]
>> >
>> > Try this:
>> >
> http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/946e66e23a0010f5
>> > Hope this helps,
>>
>> thanks, but unfortunately, it uses error catching [on error resume next]
>>
>> isn't it little bit unusual not to have *built in* tool for complete
>> variable handling?
>>
>> or, are there some advices to use "dictionary object" or "collection" [or
>> something else] for representing dynamic data structures that tends to be
>> sometimes "empty"?
>> maybe the collection is the best candidate, because it employes access by
>> numeric index as well?
>>
>>
>>
>
>


.



Relevant Pages

  • Re: Question about smp_read_barrier_depends() in kernel/marker.c
    ... so put the explicit barrier here. ... sure the array data is written before the array pointer. ... Update the function or multi probe array pointer before setting the ...
    (Linux-Kernel)
  • Re: Array descriptors
    ... other than the parent scope of the array. ... Just as the virtual origin can be computed from the actual ... origin, the strides, and the lower bounds, ... that are contained in an array pointer. ...
    (comp.lang.fortran)
  • Re: [PHP] Using next() inside a foreach
    ... The latter bug is described as a documentation issue... ... This new behavior in 5.2.4 breaks array look-ahead logic, ... Perhaps the previous behavior was to increment the array pointer at the ... END of the foreach block, and now for some reason it's incrementing it ...
    (php.general)
  • Re: Looping through array, deleting elements
    ... You are modifying the array as you iterate over it ... instruction has two attributes, parm and arg. ... the loop is looking at element x foo, ... and now array pointer is pointing at element z foo. ...
    (comp.lang.ruby)
  • Re: Gaussian cluster antenna array data
    ... A gaussian array is aimed towards resonant elements in cluster form. ... but these dimensions have not been ...
    (rec.radio.amateur.antenna)