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


2.3.3 Type kinds

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.

KindMacroPurpose
0CTF_K_UNKNOWNIndicates a type that cannot be represented in CTF, or that is being skipped. It is very similar to type ID 0, except that you can have multiple, distinct types of kind CTF_K_UNKNOWN.
1CTF_K_INTEGERAn integer type. See section Integer types.
2CTF_K_FLOATA floating-point type. See section Floating-point types.
3CTF_K_POINTERA pointer. See section Pointers, typedefs, and cvr-quals.
4CTF_K_ARRAYAn array. See section Arrays.
5CTF_K_FUNCTIONA function pointer. See section Function pointers.
6CTF_K_STRUCTA structure. See section Structs and unions.
7CTF_K_UNIONA union. See section Structs and unions.
8CTF_K_ENUMAn enumerated type. See section Enums.
9CTF_K_FORWARDA forward. See section Forward declarations.
10CTF_K_TYPEDEFA typedef. See section Pointers, typedefs, and cvr-quals.
11CTF_K_VOLATILEA volatile-qualified type. See section Pointers, typedefs, and cvr-quals.
12CTF_K_CONSTA const-qualified type. See section Pointers, typedefs, and cvr-quals.
13CTF_K_RESTRICTA restrict-qualified type. See section Pointers, typedefs, and cvr-quals.
14CTF_K_SLICEA 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: , Previous: , Up: The type section   [Contents][Index]