#15 closed defect (fixed)
Questions for Arrays of Simple Types (SDR Section 3.2)
| Reported by: | Owned by: | Paul Price | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Below are questions about the coding of the psArray containers and requests for
changes in the documentation and coding implementation.
- The opening sentence in Section 3.2 mentions an array for void *, but the
next section defines an array of pointers for void . Do you want to have both
void * and void array types or just void ?
- Appendix A mentions a Vector array type, psVectorArray, that is not
documented in the body of the SDR. Do you still want this? If so, how is it
defined?
- When defining the number of elements in the psFloatArray, "size" and "s" are
given, but the struct that is given doesn't have either. Do these refer to
nalloc member?
- Can the psXXXArray types be changed to have a union member to hold the array
data? (i.e. *arr would be a union). If defined this way, we wouldn't have to
create a psFloatArray, psIntarray, etc. struct for every type.
- Array types are common to other library systems, however those systems have
accessor functions to insert and delete array elements. Was there any desire to
add these types of methods to the PS arrays?
Change History (3)
comment:1 by , 22 years ago
| Owner: | changed from to |
|---|
comment:2 by , 22 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |

Arrays of void*:
The member void arr is a pointer to a pointer to void, so it is an array of
pointers to void --- an array of void*, so I believe the SDRS is consistent here.
psVectorArray:
Is not to be implemented, but was incorrectly included in the SDRS appendix. It
has been removed.
size vs nalloc:
"size" was incorrectly used in the SDRS instead of "nAlloc". It has been fixed.
psXyzArray union:
At the meeting today we decided to implement arrays in the manner defined in the
SDRS, using a common generic constructor to simplify the individual
constructors. This question hence appears to have been resolved.
Array accessors:
There probably isn't a need, so long as one knows the name of the struct member,
e.g., just as easy to do myArray->arr[i] as psArrayGetValue(myArray,i). (And
probably requires less documentation.)