Next: , Previous: , Up: The type section   [Contents][Index]


2.3.8 Arrays

Arrays are encoded as types of kind CTF_K_ARRAY in a ctf_stype_t. Both size and kind for arrays are zero. The variable-length data is a ctf_array_t: vlen in the info word should be disregarded and is always zero.

typedef struct ctf_array
{
  uint32_t cta_contents;
  uint32_t cta_index;
  uint32_t cta_nelems;
} ctf_array_t;
OffsetNameDescription
0x0uint32_t cta_contents The type of the array elements: a type ID.
0x4uint32_t cta_index The type of the array index: a type ID of an integral type. If this is a variable-length array, the index type ID will be 0 (but the actual index type of this array is probably int). Probably redundant and may be dropped in v4.
0x8uint32_t cta_nelems The number of array elements. 0 for VLAs, and also for the historical variety of VLA which has explicit zero dimensions (which will have a nonzero cta_index.)

The size of an array can be computed by simple multiplication of the size of the cta_contents type by the cta_nelems.