Next: Integer types, Previous: Type indexes and type IDs, Up: The type section [Contents][Index]
Every type in CTF is of some kind. Each kind is some variety of C type:
all structures are a single kind, as are all unions, all pointers, all arrays,
all integers regardless of their bitfield width, etc. The kind of a type is
given in the kind
field of the ctt_info
word (see section The info word, ctt_info).
The space of type kinds is only a quarter full so far, so there is plenty of
room for expansion. It is likely that in future versions of the file format,
types with smaller kinds will be more efficiently encoded than types with larger
kinds, so their numerical value will actually start to matter in future. (So
these IDs will probably change their numerical values in a later release of this
format, to move more frequently-used kinds like structures and cv-quals towards
the top of the space, and move rarely-used kinds like integers downwards. Yes,
integers are rare: how many kinds of int
are there in a program? They’re
just very frequently referenced.)
Here’s the set of kinds so far. Each kind has a #define
associated with
it, also given here.
Kind | Macro | Purpose |
---|---|---|
0 | CTF_K_UNKNOWN | Indicates a type that cannot be represented in CTF, or that is being skipped. |
1 | CTF_K_INTEGER | An integer type. See section Integer types. |
2 | CTF_K_FLOAT | A floating-point type. See section Floating-point types. |
3 | CTF_K_POINTER | A pointer. See section Pointers, typedefs, and cvr-quals. |
4 | CTF_K_ARRAY | An array. See section Arrays. |
5 | CTF_K_FUNCTION | A function pointer. See section Function pointers. |
6 | CTF_K_STRUCT | A structure. See section Structs and unions. |
7 | CTF_K_UNION | A union. See section Structs and unions. |
8 | CTF_K_ENUM | An enumerated type. See section Enums. |
9 | CTF_K_FORWARD | A forward. See section Forward declarations. |
10 | CTF_K_TYPEDEF | A typedef. See section Pointers, typedefs, and cvr-quals. |
11 | CTF_K_VOLATILE | A volatile-qualified type. See section Pointers, typedefs, and cvr-quals. |
12 | CTF_K_CONST | A const-qualified type. See section Pointers, typedefs, and cvr-quals. |
13 | CTF_K_RESTRICT | A restrict-qualified type. See section Pointers, typedefs, and cvr-quals. |
14 | CTF_K_SLICE | A slice, a change of the bit-width or offset of some other type. See section Slices. |
Now we cover all type kinds in turn. Some are more complicated than others.
Next: Integer types, Previous: Type indexes and type IDs, Up: The type section [Contents][Index]