Using the dynamic arrays in a random access manner

David Martin dmartin at
Wed Aug 8 15:23:25 UTC 2001

One problem with using the 2d and higher arrays in ajarr.c is that if one
doesn't fill them sequentially but instead uses them in a semi sparse
manner this can lead to problems.

If one wants the size of an array teh current function calls return the
maximum dimensions, but this doesn't neccessarily mean that every point
within that area has been allocated. This can lead to a warning or worse
when trying to aj...Get the value and the particular one dimensional array
doesn't stretch that far or hasn't been allocated at all.

I have a couple of patches for the Int2d arrays which add two more
function calls ajInt2dLenElem (gets the second dimension length at any
particular specified first dimension position) and ajInt2dElemExists which
checks to see whether an element has indeed been allocated yet.

The alternative is to roll some of this into ajInt2dGet so that an
attempt to access an unallocated element returns null or zero instead of
throwing an error, but I am not sure that is completely desirable.



David Martin PhD
Bioinformatics Scientific Officer
Wellcome Trust Biocentre, Dundee

More information about the emboss-dev mailing list